Mercurial > hg > mgallery
annotate mgallery.php @ 69:7777887bc515
Update header/copyright blurbs.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 14 Sep 2016 16:50:08 +0300 |
parents | 941d3be57d7b |
children | f2ba5a9f0aa8 |
rev | line source |
---|---|
0 | 1 <?php |
2 // | |
3 // Yet Another Image Gallery | |
69
7777887bc515
Update header/copyright blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
68
diff
changeset
|
4 // -- Main PHP file |
7777887bc515
Update header/copyright blurbs.
Matti Hamalainen <ccr@tnsp.org>
parents:
68
diff
changeset
|
5 // Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org> |
32 | 6 // (C) Copyright 2015-2016 Tecnic Software productions (TNSP) |
0 | 7 // |
8 require "mgallery.inc.php"; | |
9 | |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
10 $pageLang = "fi"; |
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
11 $pageLanguages = |
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
12 [ |
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 | 17 |
18 // | |
19 // Various utility functions | |
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 | 134 function mgGetImageURL() |
135 { | |
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 | 138 } |
139 | |
140 | |
141 function mgGetURL($path, $image, $entities = TRUE) | |
142 { | |
143 global $galBaseURL, $galCleanURLS; | |
144 $amp = $entities ? "&" : "&"; | |
145 | |
146 if ($galCleanURLS) | |
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 | 149 } |
150 else | |
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 | 153 $galBaseURL.mgGetSetting("mgallery_php")."?path=". |
154 $path.($image !== FALSE ? $amp."image=".$image : ""); | |
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 | 158 } |
159 | |
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"])."&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 | 176 function mgGetNaviActive(&$galIndex, $index, $delta, &$res, &$url, $entities) |
177 { | |
178 global $galPath; | |
179 $res = $index + $delta; | |
180 if ($res >= 0 && $res <= sizeof($galIndex) - 1) | |
181 { | |
182 $url = mgGetURL($galPath, $galIndex[$res], $entities); | |
183 return TRUE; | |
184 } | |
185 else | |
186 return FALSE; | |
187 } | |
188 | |
189 | |
190 function mgGetNaviControlImage(&$galIndex, $index, $class, $url) | |
191 { | |
192 global $galTNPath; | |
193 | |
194 $img = "<div class=\"imageCtrl ".$class."\">"; | |
195 | |
196 if ($url !== FALSE) | |
197 { | |
198 $img .= | |
199 "<a href=\"".$url."\"><img src=\"". | |
200 mgGetImageURL($galTNPath, $galIndex[$index]). | |
201 "\" alt=\"".$galIndex[$index]."\" /></a>"; | |
202 } | |
203 | |
204 return $img."</div>\n"; | |
205 } | |
206 | |
207 | |
208 function mgGetNaviControlImageBox(&$galIndex, $index, $class, $delta) | |
209 { | |
210 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE)) | |
211 $url = FALSE; | |
212 | |
213 return mgGetNaviControlImage($galIndex, $res, $class, $url); | |
214 } | |
215 | |
216 | |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
217 function mgGetControlText($id, $active, $url, $naviFlags) |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
218 { |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
219 if ($naviFlags & GNAV_TEXT) |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
220 { |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
221 $str = chentities(mgGetSetting("navi_ctrl_".$id)); |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
222 return |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
223 "<span class=\"naviControl ".$id."\">[". |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
224 ($active ? "<a href=\"".$url."\">".$str."</a>" : $str). |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
225 "]</span>"; |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
226 } |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
227 else |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
228 return ""; |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
229 } |
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 |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
232 function mgGetControl($id, &$galIndex, $index, $delta, $naviFlags) |
0 | 233 { |
234 $active = mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE); | |
235 if ($active && ($naviFlags & GNAV_IMG)) | |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
236 $img = mgGetNaviControlImage($galIndex, $res, $id, $url); |
0 | 237 else |
238 $img = ""; | |
239 | |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
240 $text = mgGetControlText($id, $active, $url, $naviFlags); |
0 | 241 |
242 if ($delta < 0) | |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
243 return $img.$text; |
0 | 244 else |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
245 return $text.$img; |
0 | 246 } |
247 | |
248 | |
249 function mgGetNaviControls(&$galIndex, $index, $naviFlags) | |
250 { | |
251 global $galPath; | |
252 | |
253 return | |
254 "<div class=\"naviControls\">". | |
7
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
255 mgGetControl("prev", $galIndex, $index, -1, $naviFlags). |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
256 mgGetControlText("up", TRUE, mgGetURL($galPath, FALSE), $naviFlags). |
dec931d9e860
Implement configurable navigation controls.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
257 mgGetControl("next", $galIndex, $index, 1, $naviFlags). |
0 | 258 "</div>\n"; |
259 } | |
260 | |
261 | |
262 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit) | |
263 { | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
264 global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages, $galUseTables; |
0 | 265 |
266 $galCount = count($galIndex); | |
267 if ($start >= $galCount) | |
268 return $start; | |
269 | |
270 $end = ($limit === FALSE) ? $galCount : $start + $limit; | |
271 if ($end > $galCount) $end = $galCount; | |
272 | |
273 $rowLimit = mgGetSetting("album_row_limit"); | |
274 $n = 0; | |
275 | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
276 if ($galUseTables) |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
277 echo "<table class=\"galleryTable ".$class."\">\n"; |
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
278 else |
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
279 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
|
280 |
0 | 281 for ($index = $start; $index < $end; $index++) |
282 { | |
283 $filename = &$galIndex[$index]; | |
284 $data = &$galEntries[$filename]; | |
285 | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
286 if ($galUseTables && $n == 0) echo " <tr>\n"; |
0 | 287 |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
288 if ($galUseTables) |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
289 echo " <td class=\"galleryEntry\" id=\"cd".$data["base"]."\">\n"; |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
290 else |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
291 echo " <div class=\"galleryEntry\">\n"; |
0 | 292 |
293 if ($data["type"] == 0) | |
294 { | |
295 echo | |
38
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
296 " <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data). |
3f16beb79f9e
Add image title string to certain images.
Matti Hamalainen <ccr@tnsp.org>
parents:
35
diff
changeset
|
297 "\"><a href=\"".mgGetURL($galPath, $filename)."\">". |
0 | 298 "<img src=\"".mgGetImageURL($galTNPath, $filename)."\" alt=\"". |
24 | 299 chentities($filename)."\"></a></div>\n". |
300 mgGetArr($data, "caption", " <div class=\"imageCaption\">%1</div>\n", "", "chentities"); | |
0 | 301 /* |
302 if ($mode == "") | |
303 { | |
304 echo | |
305 " <select class=\"dropdown\" id=\"dd".$data["base"]."\" name=\"dd".$data["base"]. | |
306 "\" onchange=\"galPhotoDataChanged('".$data["base"]."');\">\n"; | |
307 | |
308 foreach ($picChoices as $name => $value) | |
309 { | |
310 echo " <option value=\"$value\"".($value == $data["id"] ? " selected=\"selected\"" : "").">".chentities($name)."</option>\n"; | |
311 } | |
312 echo | |
313 " </select>\n"; | |
314 } | |
315 */ | |
316 } | |
317 else | |
318 { | |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
319 if ($galUseCoverImages && isset($data["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
320 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
321 // Recursively determine the album cover image |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
322 $ptmp = [$galPath, $filename]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
323 $curr = &$data; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
324 while (is_array($curr["image"])) |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
325 { |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
326 $curr = &$curr["image"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
327 $ptmp[] = $curr["base"]; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
328 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
329 |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
330 $ptmp[] = $galTNPath; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
331 $ptmp[] = $curr["image"]; |
39 | 332 |
35
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
333 $atmp = $galImageURL.implode("/", mgCleanPathArray(TRUE, 0, count($ptmp), $ptmp)); |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
334 } |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
335 else |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
336 // No album cover, use default |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
337 $atmp = $galAlbumIcon; |
985596db0f01
Implement recursive depth album covers.
Matti Hamalainen <ccr@tnsp.org>
parents:
34
diff
changeset
|
338 |
0 | 339 echo |
24 | 340 " <a href=\"".mgGetURL(mgCleanPath(TRUE, $galPath, $filename), FALSE)."\">". |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
341 "<img class=\"albumIcon\" src=\"".$atmp."\" alt=\"". |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
342 mgGetTrans($data["caption"], TRUE). |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
343 "\" />\n". |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
344 " <div class=\"albumTitle\">".mgGetTrans($data["caption"], TRUE)."</div></a>\n"; |
0 | 345 } |
346 | |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
347 if ($galUseTables) |
0 | 348 { |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
349 echo " </td>\n"; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
350 if (++$n >= $rowLimit) |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
351 { |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
352 echo " </tr>\n"; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
353 $n = 0; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
354 } |
0 | 355 } |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
356 else |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
357 echo " </div>\n"; |
0 | 358 } |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
359 |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
360 if ($galUseTables) |
0 | 361 { |
19
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
362 if ($n > 0) |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
363 { |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
364 while ($n++ < $rowLimit) |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
365 echo " <td></td>\n"; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
366 echo " </tr>\n"; |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
367 } |
59075f5e7a62
Add configuration setting to enable and disable use of HTML table elements.
Matti Hamalainen <ccr@tnsp.org>
parents:
17
diff
changeset
|
368 echo "</table>\n"; |
0 | 369 } |
20
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
370 else |
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
371 echo "</div>\n"; |
12916fcdb8b8
Improve the non-tabled mode.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
372 |
0 | 373 return $index; |
374 } | |
375 | |
376 | |
377 function mgTimeStr($str) | |
378 { | |
379 $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
|
380 return date_format($tmp, "d M Y (H:i:s)"); |
0 | 381 } |
382 | |
383 | |
384 function mgPrintPageInfoFooter() | |
385 { | |
386 if (($str = mgGetSetting("page_info")) !== FALSE) | |
387 echo "<div class=\"pageInfoFooter\">".$str."</div>"; | |
388 } | |
389 | |
390 | |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
391 function mgGetBreadCrump($class, &$pdata) |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
392 { |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
393 return |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
394 "<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
|
395 mgGetTrans($pdata["caption"], TRUE). |
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
396 "</a>"; |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
397 } |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
398 |
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
399 |
0 | 400 function mgPrintBreadCrumbs($galData) |
401 { | |
63
1c32ece9acde
Some residual array() => [] conversions.
Matti Hamalainen <ccr@tnsp.org>
parents:
49
diff
changeset
|
402 $res = []; |
0 | 403 if ($galData["caption"]) |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
404 $res[] = mgGetBreadCrump("naviBreadCrumbCurr", $galData); |
0 | 405 |
406 $tmp = $galData; | |
407 while (isset($tmp["parent"])) | |
408 { | |
409 $pdata = $tmp["parent"]; | |
31
300396947f04
Remove slight code duplication by factoring to a helper function.
Matti Hamalainen <ccr@tnsp.org>
parents:
29
diff
changeset
|
410 $res[] = mgGetBreadCrump("naviBreadCrumbItem", $pdata); |
0 | 411 $tmp = $tmp["parent"]; |
412 } | |
413 | |
414 if (count($res) > 1) | |
415 { | |
416 echo | |
417 "<div class=\"naviBreadCrumbs\">". | |
418 implode("<span class=\"naviBreadCrumbSep\"></span>", array_reverse($res)). | |
419 "</div>\n"; | |
420 } | |
421 } | |
422 | |
423 | |
424 // | |
65
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
425 // Check language |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
426 // |
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
|
427 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
|
428 { |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
429 $tmp = strtolower($tmp); |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
430 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
|
431 { |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
432 $pageLang = $tmp; |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
433 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
|
434 } |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
435 } |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
436 else |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
437 if (isset($_COOKIE["mglang"])) |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
438 { |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
439 $tmp = strtolower($_COOKIE["mglang"]); |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
440 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
|
441 $pageLang = $tmp; |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
442 } |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
443 |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
444 |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
445 // |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
446 // Check for "from" redirection |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
447 // |
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
|
448 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
|
449 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
|
450 { |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
451 header("Location: ".$from); |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
452 exit; |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
453 } |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
454 |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
455 |
7019d87bc479
Improve/fix language selection support to store language cookie better.
Matti Hamalainen <ccr@tnsp.org>
parents:
63
diff
changeset
|
456 // |
0 | 457 // Get gallery settings |
458 // | |
459 mgReadSettings(); | |
460 | |
461 $pageCSS = mgGetSetting("css"); | |
462 $pageCSSSelect = mgGetSetting("css_select"); | |
463 $galBasePath = mgGetSetting("base_path"); | |
464 $galBaseURL = mgGetSetting("base_url"); | |
465 $galImageURL = mgGetSetting("image_url", mgGetSetting("base_url")); | |
466 | |
17
3f7bc4202df3
Add new configuration setting 'cover_images' to disable/enable sub-album
Matti Hamalainen <ccr@tnsp.org>
parents:
13
diff
changeset
|
467 $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
|
468 $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
|
469 |
0 | 470 $galAlbumIcon = mgGetSetting("album_icon"); |
471 $galCleanURLS = mgGetSetting("clean_urls"); | |
472 $galTNPath = mgGetSetting("tn_path"); | |
473 $galMedSuffix = mgGetSetting("med_suffix"); | |
474 $galTitlePrefix = mgGetSetting("title_prefix"); | |
475 $galTitleSep = mgGetSetting("title_sep"); | |
476 | |
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
|
477 $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
|
478 $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
|
479 $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
|
480 $galImage = mgGetRequestItem("image", FALSE, TRUE); |
0 | 481 |
482 if (is_string($galImage)) | |
483 $galImage = basename($galImage); | |
484 | |
485 | |
486 // | |
487 // Attempt to read the data cache file | |
488 // | |
489 $filename = mgGetPath(mgCleanPath(TRUE, $galBasePath, $galPath), "cache_file"); | |
490 $filename2 = mgGetPath(mgCleanPath(FALSE, $galBasePath, $galPath), "cache_file"); | |
491 if ($filename == $filename2 && file_exists($filename) && ($fp = @fopen($filename, "rb")) !== FALSE) | |
492 { | |
493 if (flock($fp, LOCK_SH)) | |
494 { | |
495 require($filename); | |
496 flock($fp, LOCK_UN); | |
497 } | |
498 fclose($fp); | |
499 } | |
500 | |
501 | |
502 // If no data available, show an error page | |
503 if (!isset($galData) || !isset($galEntries) || | |
504 !isset($galAlbumsIndex) || !isset($galImagesIndex)) | |
505 { | |
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
|
506 mgPrintPageHeader(mgGetVal(["title_prefix", "title_sep"], "%1%2")."ERROR!"); |
0 | 507 |
508 echo | |
509 "<h1>Gallery error</h1>\n". | |
510 "<p>Gallery path <b>".chentities($galPath)."</b> does not exist or is invalid.</p>\n"; | |
511 | |
12
79987aa7ee9a
Change some debugging (commented out).
Matti Hamalainen <ccr@tnsp.org>
parents:
7
diff
changeset
|
512 //echo "<p>filename=: '".$filename."', X: galData=".intval(isset($galData)).", galEntries=".intval(isset($galEntries))."\n"; |
0 | 513 |
514 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
|
515 mgPrintPageFooter(TRUE); |
0 | 516 exit; |
517 } | |
518 | |
519 | |
520 // | |
521 // Print page header, etc. | |
522 // | |
523 if (($index = array_search($galImage, $galImagesIndex)) !== FALSE) | |
524 { | |
525 // | |
526 // Single image mode | |
527 // | |
528 $naviFlags = mgGetSetting("image_navigation"); | |
529 $data = $galEntries[$galImage]; | |
530 | |
66 | 531 $list = [ |
532 mgGetArr($data, ["width", "height"], "<span class=\"infoDimensions\"><b>%1</b> x <b>%2</b> px</span>", NULL), | |
533 mgGetArr($data, "model", "<span class=\"infoModel\"><b>%1</b></span>", NULL), | |
534 mgGetArr($data, "fnumber", "<span class=\"infoFNumber\"><b>f/%1</b></span>", NULL), | |
535 mgGetArr($data, "exposure", "<span class=\"infoExposure\"><b>%1</b> sec</span>", NULL, NULL), | |
536 mgGetArr($data, "iso", "<span class=\"infoISO\">ISO <b>%1</b></span>", NULL), | |
537 mgGetArr($data, "focallength", "<span class=\"infoFocalLength\">F-L <b>%1</b>mm</span>", NULL), | |
538 mgGetArr($data, "lensmodel", "<span class=\"infoLensModel\"><i>%1</i></span>", NULL), | |
539 ]; | |
540 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
541 $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
|
542 mgPrintPageHeader($pageTitle); |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
543 echo |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
544 mgGetLanguageSelector(). |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
545 "<div id=\"imageLarge\"><img src=\"". |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
546 $galImageURL.$galPath."/".$galImage."\" alt=\"". |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
547 chentities($data["base"].$galMedSuffix.$data["ext"])."\" /></div>\n". |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
548 "<h1>".chentities($pageTitle)."</h1>\n"; |
0 | 549 |
550 if ($naviFlags & GNAV_BREADCRUMBS) | |
551 mgPrintBreadCrumbs($galData); | |
552 | |
553 if ($naviFlags & GNAV_TOP) | |
554 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags); | |
555 | |
556 echo | |
66 | 557 "<div class=\"imageCBox\">\n". |
558 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1). | |
559 "<div class=\"imageBox\">\n". | |
560 "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">". | |
561 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\"></a>\n". | |
562 "</div>\n". | |
563 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1). | |
564 "<div class=\"imageCaption\">".mgGetArr($data, "caption", "%1", "")."</div>\n". | |
0 | 565 "<div class=\"infoBox\">\n". |
566 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>", "", "mgTimeStr"). | |
567 implode(", ", array_filter($list, function($a) { return $a !== NULL; })). | |
67
fc4900455610
Slightly adjust gallery html structure.
Matti Hamalainen <ccr@tnsp.org>
parents:
66
diff
changeset
|
568 "</div>\n". |
0 | 569 "</div>\n"; |
570 | |
571 if ($naviFlags & GNAV_BOTTOM) | |
572 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags); | |
573 | |
574 // Javascript navigation | |
575 if ($naviFlags & GNAV_JAVASCRIPT) | |
576 { | |
577 $prevActive = mgGetNaviActive($galImagesIndex, $index, -1, $res, $prevURL, FALSE); | |
578 $nextActive = mgGetNaviActive($galImagesIndex, $index, 1, $res, $nextURL, FALSE); | |
579 echo | |
580 "<script type=\"text/javascript\">\n". | |
581 "var mgalPrevURL = \"".($prevActive ? $prevURL : "")."\";\n". | |
582 "var mgalNextURL = \"".($nextActive ? $nextURL : "")."\";\n". | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
583 "var mgalExpanded = false;\n". |
0 | 584 "\n"; |
585 ?> | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
586 function mgalExpandClose(force) |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
587 { |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
588 mgalExpanded = !mgalExpanded; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
589 if (!force) |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
590 mgalExpanded = false; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
591 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
592 var mlink = document.getElementById("imageLink"); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
593 var mlarge = document.getElementById("imageLarge"); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
594 if (mlink && mlarge) |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
595 { |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
596 mlink.style.visibility = mgalExpanded ? "hidden" : "visible"; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
597 mlarge.style.display = mgalExpanded ? "block" : "none"; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
598 } |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
599 return false; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
600 } |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
601 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
602 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
603 function mgalMouseExpandClose(event, force) |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
604 { |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
605 if (!event.ctrlKey) |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
606 return mgalExpandClose(force); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
607 else |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
608 return true; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
609 } |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
610 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
611 |
0 | 612 function mgalNavigateTo(url) |
613 { | |
43 | 614 if (url != "") |
615 window.location = url; | |
0 | 616 } |
617 | |
618 | |
619 function mgalProcessKeyPress(ev) | |
620 { | |
43 | 621 ev = ev || window.event; |
622 var key = ev.keyCode ? ev.keyCode : ev.which; | |
623 switch (key) | |
624 { | |
625 case 37: | |
626 case 65: | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
627 case 52: |
43 | 628 // left |
629 mgalNavigateTo(mgalPrevURL); | |
630 break; | |
0 | 631 |
43 | 632 case 39: |
633 case 68: | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
634 case 54: |
43 | 635 // right |
636 mgalNavigateTo(mgalNextURL); | |
637 break; | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
638 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
639 case 13: |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
640 case 48: |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
641 mgalExpandClose(true); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
642 break; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
643 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
644 case 27: |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
645 mgalExpandClose(false); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
646 break; |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
647 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
648 default: |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
649 return true; |
43 | 650 } |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
651 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
652 ev.preventDefault(); |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
653 return false; |
0 | 654 } |
655 | |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
656 |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
657 document.getElementById("imageLarge").onclick = function(event) { return mgalMouseExpandClose(event, false); } |
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
658 document.getElementById("imageLink").onclick = function(event) { return mgalMouseExpandClose(event, true); } |
0 | 659 document.onkeypress = mgalProcessKeyPress; |
44
bc9da3b71888
Implement imgur-style image zoom/de-zoom via image click/enter.
Matti Hamalainen <ccr@tnsp.org>
parents:
43
diff
changeset
|
660 |
0 | 661 <? |
662 echo | |
663 "</script>\n"; | |
664 } | |
665 } | |
666 else | |
667 { | |
668 // | |
669 // Gallery mode | |
670 // | |
671 // - needs sub-modes / handling of order shit | |
672 // - Javascript stuff for picture data updates | |
673 // | |
674 $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
|
675 mgPrintPageHeader($pageTitle); |
48
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
676 echo |
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
677 mgGetLanguageSelector(). |
5a2dd41ff7ad
Initial implementation of language selector.
Matti Hamalainen <ccr@tnsp.org>
parents:
47
diff
changeset
|
678 "<h1>".$pageTitle."</h1>\n"; |
0 | 679 |
680 $naviFlags = mgGetSetting("album_navigation"); | |
681 if ($naviFlags & GNAV_BREADCRUMBS) | |
682 mgPrintBreadCrumbs($galData); | |
683 | |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
684 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
|
685 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
686 // 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
|
687 $baseURL = mgGetSetting("image_url"); |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
688 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
689 $headerText = preg_replace_callback( |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
690 "@href\s*=\s*\"([^\"]+)\"@i", |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
691 function ($matches) use($galPath, $baseURL) |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
692 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
693 $mstmp = $matches[1]; |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
694 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
|
695 { |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
696 if ($mstmp[0] != "/") |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
697 $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
|
698 } |
28
2d8112d6c3bc
Fix relative links re-parsing.
Matti Hamalainen <ccr@tnsp.org>
parents:
27
diff
changeset
|
699 return "href=\"".$mstmp."\""; |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
700 }, |
47
1e2b55775a84
Begin implementation of translated caption/title support.
Matti Hamalainen <ccr@tnsp.org>
parents:
44
diff
changeset
|
701 $gheader); |
13
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
702 |
951752fb1c21
Add translation of relative URLs in header text blocks.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
703 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
|
704 } |
0 | 705 |
706 mgPrintTable("albumTable", $galEntries, $galAlbumsIndex, 0, FALSE); | |
707 mgPrintTable("imageTable", $galEntries, $galImagesIndex, 0, FALSE); | |
708 } | |
709 | |
710 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
|
711 mgPrintPageFooter(TRUE); |
0 | 712 ?> |