annotate mgallery.php @ 87:f150d044f743

Adjust image scaling coefficient.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 15 Sep 2016 13:44:04 +0300
parents fd08e061413b
children d9524db8f6a5
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>
32
953b0f7636f4 Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 31
diff changeset
6 // (C) Copyright 2015-2016 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 [
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
13 "fi" => "Finnish",
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
14 "en" => "English",
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
15 ];
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
16
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 // Various utility functions
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 //
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
21 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
22 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
23 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
24 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
25 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
26 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
27 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
28
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
29
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
30 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
31 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
32 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
33 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
34 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
35 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
36 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
37
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
38
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
39 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
40 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
41 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
42 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
43
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
44
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
45 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
46 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
47 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
48 " <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
49 "\" 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
50 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
51
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
52
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
53 function mgPrintPageHeader($pageTitle, $pageExtra = "", $useContents = 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
54 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
55 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
56
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
57 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
58 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
59 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
60 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
61 $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
62 "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
63 "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
64 );
941d3be57d7b Get rid 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 }
941d3be57d7b Get rid 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
941d3be57d7b Get rid 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 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
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 $pageCSSIndex = intval($_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
70 setcookie($pageCSSData["cookie"], $pageCSSIndex, time() + 365*24*60*60, "/"); // expire in a year
941d3be57d7b Get rid 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 }
941d3be57d7b Get rid 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 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
73 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
74 $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
75 }
941d3be57d7b Get rid 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 $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
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 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
80 "<!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
81 "<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
82 "<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
83 " <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
84 " <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
85 " <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
86 $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
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 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
89 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
90 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
91 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
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 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
94 {
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
95 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
96 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
97
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
98 echo
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
99 "</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
100 "<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
101
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
102 /*
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
103 if (isset($pageUrchin) && file_exists($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
104 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
105 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
106 if (file_exists("urchin.inc.php"))
941d3be57d7b Get rid 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 require_once "urchin.inc.php";
941d3be57d7b Get rid 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 */
941d3be57d7b Get rid 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 echo "<div id=\"messageBox\"></div>\n";
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
111
941d3be57d7b Get rid 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 if ($useContents)
941d3be57d7b Get rid 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 echo "<div id=\"contents\">\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
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
941d3be57d7b Get rid 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 function mgPrintPageFooter($useContents = 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
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 if ($useContents)
941d3be57d7b Get rid 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 "</div>\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
121
941d3be57d7b Get rid 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 echo "</body>\n</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 }
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
124
941d3be57d7b Get rid of mgeneric.inc.php dependency, as we don't need much from there .. for now.
Matti Hamalainen <ccr@tnsp.org>
parents: 67
diff changeset
125
38
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
126 function mgGetImageTitleStr($filename, &$data)
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
127 {
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
128 return
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
129 chentities($filename).
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
130 mgGetArr($data, "datetime", " - %1", "", "mgTimeStr");
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
131 }
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
132
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
133
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 function mgGetImageURL()
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 global $galImageURL, $galPath;
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
137 return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args()));
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 function mgGetURL($path, $image, $entities = TRUE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 global $galBaseURL, $galCleanURLS;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 $amp = $entities ? "&amp;" : "&";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146 if ($galCleanURLS)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
148 $url = $galBaseURL.$path."/".($image !== FALSE ? $image : "");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 {
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
152 $url =
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153 $galBaseURL.mgGetSetting("mgallery_php")."?path=".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 $path.($image !== FALSE ? $amp."image=".$image : "");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 }
5
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
156
1bf73b49fc91 Beautify the generated URLs by removing occurences of duplicate forward
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
157 return str_replace("//", "/", $url);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
161 function mgGetLanguageSelector()
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
162 {
65
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
163 global $pageLang, $pageLanguages, $galBaseURL;
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
164 if (isset($pageLanguages) && count($pageLanguages) > 0)
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
165 {
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
166 $str = "<div id=\"languages\">";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
167 foreach ($pageLanguages as $id => $lang)
65
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
168 $str .= "<a href=\"".$galBaseURL."?from=".urlencode($_SERVER["REQUEST_URI"])."&amp;lang=".$id."\">".$lang."</a> ";
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
169 return $str."</div>\n";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
170 }
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
171 else
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
172 return "";
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
173 }
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
174
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
175
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities)
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 $galPath;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 $res = $index + $delta;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 if ($res >= 0 && $res <= sizeof($galIndex) - 1)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 $url = mgGetURL($galPath, $galIndex[$res], $entities);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 return TRUE;
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 return FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 function mgGetNaviControlImage(&$galIndex, $index, $class, $url)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 global $galTNPath;
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 if ($url !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195 {
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
196 return
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
197 "<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
198 "<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
199 mgGetImageURL($galTNPath, $galIndex[$index]).
84
09f8b73ce6f9 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 83
diff changeset
200 "\" alt=\"".$galIndex[$index]."\" /></a></div>";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 }
75
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
202 else
441d5338960e Image control not needed when prev/next image does not exist.
Matti Hamalainen <ccr@tnsp.org>
parents: 74
diff changeset
203 return "";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207 function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 $url = FALSE;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 return mgGetNaviControlImage($galIndex, $res, $class, $url);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215
86
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
216 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
217 {
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
218 return
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
219 "<script type=\"text/javascript\">".
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
220 "document.write(\"".str_replace("\"", "\\\"",
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
221 mgGetNaviControlImageBox($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
222 "\");".
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
223 "</script>";
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
224 }
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
225
fd08e061413b Use JavaScript to generate the "shadow"/bottom navigation elements in the
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
226
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
227 function mgGetControlText($id, $active, $url, $naviFlags)
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
228 {
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
229 if ($naviFlags & GNAV_TEXT)
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
230 {
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
231 $str = chentities(mgGetSetting("navi_ctrl_".$id));
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
232 return
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
233 "<span class=\"naviControl ".$id."\">[".
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
234 ($active ? "<a href=\"".$url."\">".$str."</a>" : $str).
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
235 "]</span>";
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
236 }
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
237 else
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
238 return "";
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
239 }
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
240
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
241
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
242 function mgGetControl($id, &$galIndex, $index, $delta, $naviFlags)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 $active = mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 if ($active && ($naviFlags & GNAV_IMG))
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
246 $img = mgGetNaviControlImage($galIndex, $res, $id, $url);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248 $img = "";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
250 $text = mgGetControlText($id, $active, $url, $naviFlags);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252 if ($delta < 0)
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
253 return $img.$text;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 else
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
255 return $text.$img;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 function mgGetNaviControls(&$galIndex, $index, $naviFlags)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 global $galPath;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 return
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 "<div class=\"naviControls\">".
7
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
265 mgGetControl("prev", $galIndex, $index, -1, $naviFlags).
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
266 mgGetControlText("up", TRUE, mgGetURL($galPath, FALSE), $naviFlags).
dec931d9e860 Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
267 mgGetControl("next", $galIndex, $index, 1, $naviFlags).
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 "</div>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
274 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables;
0
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 $galCount = count($galIndex);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 if ($start >= $galCount)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 return $start;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 $end = ($limit === FALSE) ? $galCount : $start + $limit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 if ($end > $galCount) $end = $galCount;
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 $rowLimit = mgGetSetting("album_row_limit");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 $n = 0;
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)
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
287 echo "<table class=\"galleryTable ".$class."\">\n";
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
288 else
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
289 echo "<div class=\"galleryTable ".$class."\">\n";
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
290
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 for ($index = $start; $index < $end; $index++)
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 $filename = &$galIndex[$index];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 $data = &$galEntries[$filename];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
296 if ($galUseTables && $n == 0) echo " <tr>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
298 if ($galUseTables)
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
299 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
300 else
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
301 echo " <div class=\"galleryEntry\">\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303 if ($data["type"] == 0)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 echo
38
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
306 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data).
3f16beb79f9e Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents: 35
diff changeset
307 "\"><a href=\"".mgGetURL($galPath, $filename)."\">".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 "<img src=\"".mgGetImageURL($galTNPath, $filename)."\" alt=\"".
24
7f5209a6f7e0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
309 chentities($filename)."\"></a></div>\n".
7f5209a6f7e0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
310 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities");
0
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 if ($mode == "")
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"].
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 "\" onchange=\"galPhotoDataChanged('".$data["base"]."');\">\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 foreach ($picChoices as $name => $value)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 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
321 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 " </select>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325 */
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 else
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 {
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
329 if ($galUseCoverImages && isset($data["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
330 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
331 // Recursively determine the album cover image
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
332 $ptmp = [$galPath, $filename];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
333 $curr = &$data;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
334 while (is_array($curr["image"]))
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
335 {
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
336 $curr = &$curr["image"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
337 $ptmp[] = $curr["base"];
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
338 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
339
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
340 $ptmp[] = $galTNPath;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
341 $ptmp[] = $curr["image"];
39
c1188641c5b7 Whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 38
diff changeset
342
35
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
343 $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp));
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
344 }
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
345 else
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
346 // No album cover, use default
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
347 $atmp = $galAlbumIcon;
985596db0f01 Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents: 34
diff changeset
348
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 echo
24
7f5209a6f7e0 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 20
diff changeset
350 " <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
351 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
352 mgGetTrans($data["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
353 "\" />\n".
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
354 " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
357 if ($galUseTables)
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 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
360 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
361 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
362 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
363 $n = 0;
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
364 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
366 else
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
367 echo " </div>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368 }
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
369
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
370 if ($galUseTables)
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 {
19
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
372 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
373 {
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
374 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
375 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
376 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
377 }
59075f5e7a62 Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents: 17
diff changeset
378 echo "</table>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 }
20
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
380 else
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
381 echo "</div>\n";
12916fcdb8b8 Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
382
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 return $index;
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 function mgTimeStr($str)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 $tmp = date_create_from_format("Y:m:d H:i:s", $str);
34
e786771dfaa5 Add seconds to outputted timestamps.
Matti Hamalainen <ccr@tnsp.org>
parents: 32
diff changeset
390 return date_format($tmp, "d M Y (H:i:s)");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393
78
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
394 function mgFileSize($size)
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 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
397 {
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
398 if ($size > $mdiv)
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
399 return sprintf("%1.2f %s", $size / $mdiv, $mpost);
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
400 }
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
401 return sprintf("%d bytes", $size);
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
402 }
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
403
b7f2e643279f Add file size to information shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 76
diff changeset
404
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 function mgPrintPageInfoFooter()
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 if (($str = mgGetSetting("page_info")) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 echo "<div class=\"pageInfoFooter\">".$str."</div>";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 }
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
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
412 function mgGetBreadCrump($class, &$pdata)
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
413 {
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
414 return
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
415 "<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
416 mgGetTrans($pdata["caption"], TRUE).
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
417 "</a>";
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
418 }
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
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 function mgPrintBreadCrumbs($galData)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422 {
63
1c32ece9acde Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
423 $res = [];
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424 if ($galData["caption"])
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
425 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 $tmp = $galData;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 while (isset($tmp["parent"]))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430 $pdata = $tmp["parent"];
31
300396947f04 Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
431 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 $tmp = $tmp["parent"];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 if (count($res) > 1)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 "<div class=\"naviBreadCrumbs\">".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)).
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 "</div>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 }
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 //
76
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
446 // Global locale initialization
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
447 //
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
448 if (!isset($localeInited) || !$localeInited)
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
449 {
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
450 $localeInited = TRUE;
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
451 $pageCharset = "UTF-8";
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
452
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
453 mb_internal_encoding($pageCharset);
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
454
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
455 $tmp = "en_US.".strtolower(str_replace("-", "", $pageCharset));
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
456 setlocale(LC_ALL, $tmp);
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
457 }
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
f2e923f84e1b Initialize locale.
Matti Hamalainen <ccr@tnsp.org>
parents: 75
diff changeset
460 //
65
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
461 // Check language
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
462 //
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
463 if (($tmp = mgGetRequestItem("lang", FALSE, TRUE)) !== FALSE)
65
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
464 {
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
465 $tmp = strtolower($tmp);
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
466 if (array_key_exists($tmp, $pageLanguages))
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
467 {
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
468 $pageLang = $tmp;
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
469 setcookie("mglang", $tmp, time() + 365*24*60*60); // expire in a year
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
470 }
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
471 }
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
472 else
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
473 if (isset($_COOKIE["mglang"]))
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
474 {
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
475 $tmp = strtolower($_COOKIE["mglang"]);
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
476 if (array_key_exists($tmp, $pageLanguages))
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
477 $pageLang = $tmp;
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
478 }
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
479
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
480
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
481 //
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
482 // Check for "from" redirection
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
483 //
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
484 if (($from = mgGetRequestItem("from", FALSE, TRUE)) !== FALSE &&
65
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
485 preg_match("@^[a-z0-9/_.]+\$@i", $from))
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
486 {
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
487 header("Location: ".$from);
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
488 exit;
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
489 }
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
490
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
491
7019d87bc479 Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents: 63
diff changeset
492 //
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 // Get gallery settings
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 mgReadSettings();
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 $pageCSS = mgGetSetting("css");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 $pageCSSSelect = mgGetSetting("css_select");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499 $galBasePath = mgGetSetting("base_path");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500 $galBaseURL = mgGetSetting("base_url");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url"));
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502
17
3f7bc4202df3 Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents: 13
diff changeset
503 $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
504 $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
505
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506 $galAlbumIcon = mgGetSetting("album_icon");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 $galCleanURLS = mgGetSetting("clean_urls");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 $galTNPath = mgGetSetting("tn_path");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 $galMedSuffix = mgGetSetting("med_suffix");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 $galTitlePrefix = mgGetSetting("title_prefix");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 $galTitleSep = mgGetSetting("title_sep");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512
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
513 $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
514 $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
515 $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
516 $galImage = mgGetRequestItem("image", FALSE, TRUE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518 if (is_string($galImage))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519 $galImage = basename($galImage);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 // Attempt to read the data cache file
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 if (flock($fp, LOCK_SH))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 require($filename);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 flock($fp, LOCK_UN);
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 fclose($fp);
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
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538 // If no data available, show an error page
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 if (!isset($galData) || !isset($galEntries) ||
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540 !isset($galAlbumsIndex) || !isset($galImagesIndex))
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 {
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
542 mgPrintPageHeader(mgGetVal(["title_prefix", "title_sep"], "%1%2")."ERROR!");
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 "<h1>Gallery error</h1>\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 "<p>Gallery path <b>".chentities($galPath)."</b> does not exist or is invalid.</p>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547
12
79987aa7ee9a Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
548 //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
549
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550 mgPrintPageInfoFooter();
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
551 mgPrintPageFooter(TRUE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 exit;
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557 // Print page header, etc.
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 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE)
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 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 // Single image mode
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 $naviFlags = mgGetSetting("image_navigation");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565 $data = $galEntries[$galImage];
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
567 $list = [
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
568 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
569 mgGetArr($data, "model", "<span class=\"infoModel\"><b>%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
570 mgGetArr($data, "fnumber", "<span class=\"infoFNumber\"><b>f/%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
571 mgGetArr($data, "exposure", "<span class=\"infoExposure\"><b>%1</b> sec</span>", NULL, NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
572 mgGetArr($data, "iso", "<span class=\"infoISO\">ISO <b>%1</b></span>", NULL),
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
573 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
574 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
575 mgGetArr($data, "filesize", "<span class=\"infoFileSize\">%1</span>", "", "mgFileSize"),
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
576 ];
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
577
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
578 $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
579 mgPrintPageHeader($pageTitle);
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
580 echo
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
581 mgGetLanguageSelector().
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
582 "<h1>".chentities($pageTitle)."</h1>\n";
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584 if ($naviFlags & GNAV_BREADCRUMBS)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 if ($naviFlags & GNAV_TOP)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 echo
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
591 "<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
592 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
593 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
66
be68b2d06674 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 65
diff changeset
594 "<div class=\"imageBox\">\n".
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
595 // "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
596 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">".
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
597 // "</a>\n".
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".
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
602 "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603 "<div class=\"infoBox\">\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>", "", "mgTimeStr").
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 implode(", ", array_filter($list, function($a) { return $a !== NULL; })).
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
606 "</div>".
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
607 "</a>\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 if ($naviFlags & GNAV_BOTTOM)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags);
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 // Javascript navigation
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 if ($naviFlags & GNAV_JAVASCRIPT)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 {
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 "<script type=\"text/javascript\">\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 "var mgalPrevURL = \"".($prevActive ? $prevURL : "")."\";\n".
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 "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
622 "var mgalUpURL = \"".mgGetURL($galData["path"], FALSE)."\";\n".
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 "\n";
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
624
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 ?>
81
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
626 function mgalAddEvent(evobj, evtype, evcallback)
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 == null || typeof(evobj) == 'undefined')
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
629 return;
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
630
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
631 if (evobj.addEventListener)
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
632 evobj.addEventListener(evtype, evcallback, false);
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 if (evobj.attachEvent)
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
635 evobj.attachEvent("on" + evtype, evcallback);
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
636 else
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
637 evobj["on"+evtype] = evcallback;
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
638 };
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
639
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
640
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641 function mgalNavigateTo(url)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 {
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
643 if (url != "")
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
644 window.location = url;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 function mgalProcessKeyPress(ev)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 {
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
650 ev = ev || window.event;
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
651 var key = ev.keyCode ? ev.keyCode : ev.which;
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
652 switch (key)
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
653 {
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
654 case 37:
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
655 case 65:
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
656 case 52:
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
657 // left
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
658 mgalNavigateTo(mgalPrevURL);
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
659 break;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
661 case 39:
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
662 case 68:
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
663 case 54:
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
664 // right
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
665 mgalNavigateTo(mgalNextURL);
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
666 break;
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
667
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
668 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
669 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
670 // 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
671 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
672 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
673
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
674 default:
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
675 return true;
43
fc8e6a056016 Indentation fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
676 }
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
677
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
678 ev.preventDefault();
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
679 return false;
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
682
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
683 function mgalGetWindowSize()
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 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
686 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
687 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
688 // Non-MSIE
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
689 winW = window.innerWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
690 winH = window.innerHeight;
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 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
693 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
694 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
695 // 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
696 winW = document.documentElement.clientWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
697 winH = document.documentElement.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 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
700 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
701 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
702 // MSIE 4 compatible
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
703 winW = document.body.clientWidth;
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
704 winH = document.body.clientHeight;
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 return [winW, winH];
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
708 }
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
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
711 function mgalAdjustImage()
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
712 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
713 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
714 var win = mgalGetWindowSize();
87
f150d044f743 Adjust image scaling coefficient.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
715 var madj = 0.80;
82
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
716 if (eimg)
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
717 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
718 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
719 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
720 eimg.style.width = "100%";
83
f13b05e4c896 Possibly fix image scaling adjustments.
Matti Hamalainen <ccr@tnsp.org>
parents: 82
diff changeset
721 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
722 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
723 {
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
724 eimg.style.width = "auto";
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
725 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
726 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
727 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
728 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
729 {
83
f13b05e4c896 Possibly fix image scaling adjustments.
Matti Hamalainen <ccr@tnsp.org>
parents: 82
diff changeset
730 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
731 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
732 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
733 else
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
734 eimg.style.height = "100%";
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 }
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
738
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
739
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
740 mgalAddEvent(document.getElementById("imageImage"), "load", mgalAdjustImage);
e0e5e5197bb8 Refactor for somewhat more mobile-bullshit-friendly style and usage.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
741 mgalAddEvent(window, "resize", mgalAdjustImage);
81
697846b47d17 Add javascript helper function mgalAddEvent() and use it.
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
742 mgalAddEvent(document, "keypress", mgalProcessKeyPress);
44
bc9da3b71888 Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
743
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 <?
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 echo
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746 "</script>\n";
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
749 else
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 //
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752 // Gallery mode
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 // - needs sub-modes / handling of order shit
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 // - Javascript stuff for picture data updates
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 $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
758 mgPrintPageHeader($pageTitle);
48
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
759 echo
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
760 mgGetLanguageSelector().
5a2dd41ff7ad Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents: 47
diff changeset
761 "<h1>".$pageTitle."</h1>\n";
0
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 $naviFlags = mgGetSetting("album_navigation");
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 if ($naviFlags & GNAV_BREADCRUMBS)
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 mgPrintBreadCrumbs($galData);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
767 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
768 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
769 // 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
770 $baseURL = mgGetSetting("image_url");
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
771
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
772 $headerText = preg_replace_callback(
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
773 "@href\s*=\s*\"([^\"]+)\"@i",
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
774 function ($matches) use($galPath, $baseURL)
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
775 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
776 $mstmp = $matches[1];
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
777 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
778 {
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
779 if ($mstmp[0] != "/")
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
780 $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
781 }
28
2d8112d6c3bc Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents: 27
diff changeset
782 return "href=\"".$mstmp."\"";
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
783 },
47
1e2b55775a84 Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents: 44
diff changeset
784 $gheader);
13
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
785
951752fb1c21 Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
786 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
787 }
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
788
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
789 mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
790 mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE);
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
791 }
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
792
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
793 mgPrintPageInfoFooter();
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
794 mgPrintPageFooter(TRUE);
0
ac688606ec4b Initial import of code.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
795 ?>