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