1<?php
2
3/**
4 * Image detail page
5 *
6 * NOTE: Based on the detail.php out of the "starter" template by Anika Henke.
7 *
8 *
9 * LICENSE: This file is open source software (OSS) and may be copied under
10 *          certain conditions. See COPYING file for details or try to contact
11 *          the author(s) of this file in doubt.
12 *
13 * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html)
14 * @author ARSAVA <dokuwiki@dev.arsava.com>
15 * @link https://www.dokuwiki.org/template:prsnl10
16 * @link https://www.dokuwiki.org/devel:templates
17 * @link https://www.dokuwiki.org/devel:coding_style
18 * @link https://www.dokuwiki.org/devel:environment
19 * @link https://www.dokuwiki.org/devel:action_modes
20 */
21
22//check if we are running within the DokuWiki environment
23if (!defined("DOKU_INC")){
24    die();
25}
26
27?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
28  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
29<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo hsc($conf["lang"]); ?>" lang="<?php echo hsc($conf["lang"]); ?>" dir="<?php echo hsc($lang["direction"]); ?>">
30<head>
31<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32<title><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG)); echo " - ".hsc($conf["title"]); ?></title>
33<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
34<?php
35//show meta-tags
36tpl_metaheaders();
37echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
38
39//include default or userdefined favicon
40//
41//note: since 2011-04-22 "Rincewind RC1", there is a core function named
42//      "tpl_getFavicon()". But its functionality is not really fitting the
43//      behaviour of this template, therefore I don't use it here exclusively.
44if (file_exists(DOKU_TPLINC."user/favicon.ico")){
45    //user defined - you might find http://tools.dynamicdrive.com/favicon/
46    //useful to generate one
47    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.ico\" />\n";
48}elseif (file_exists(DOKU_TPLINC."user/favicon.png")){
49    //note: I do NOT recommend PNG for favicons (cause it is not supported by
50    //all browsers).
51    echo "\n<link rel=\"shortcut icon\" href=\"".DOKU_TPL."user/favicon.png\" />\n";
52}else{
53    //default
54    echo "\n<link rel=\"shortcut icon\" href=\"".(function_exists("tpl_getFavicon") ? tpl_getFavicon() : DOKU_TPL."images/favicon.ico")."\" />\n";
55}
56
57//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
58//details)
59if (file_exists(DOKU_TPLINC."user/apple-touch-icon.png")){
60    echo "<link rel=\"apple-touch-icon\" href=\"".DOKU_TPL."user/apple-touch-icon.png\" />\n";
61}else{
62    //default
63    echo "<link rel=\"apple-touch-icon\" href=\"".(function_exists("tpl_getFavicon") ? tpl_getFavicon(false, "apple-touch-icon.png") : DOKU_TPL."images/apple-touch-icon.png")."\" />\n";
64}
65
66//load userdefined js?
67if (tpl_getConf("prsnl10_loaduserjs")){
68    echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".DOKU_TPL."user/user.js\"></script>\n";
69}
70?>
71<!--[if lte IE 8]><link rel="stylesheet" media="all" type="text/css" href="<?php echo DOKU_TPL; ?>css/prsnl10_screen_iehacks.css" /><![endif]-->
72<!--[if lt IE 7]><style type="text/css">img, div { behavior: url(<?php echo DOKU_TPL; ?>js/iepngfix/iepngfix.htc); }</style><![endif]-->
73</head>
74
75<body>
76    <div id="dokuwiki__detail" class="dokuwiki">
77        <?php html_msgarea() ?>
78
79        <?php if($ERROR){ print $ERROR; }else{ ?>
80
81            <h1><?php echo hsc(tpl_img_getTag('IPTC.Headline',$IMG))?></h1>
82
83            <div class="content">
84                <?php tpl_img(900,700); /* parameters: maximum width, maximum height (and more) */ ?>
85
86                <div class="img_detail">
87                    <h2><?php print nl2br(hsc(tpl_img_getTag('simple.title'))); ?></h2>
88
89                    <dl>
90                        <?php
91                            $config_files = getConfigFiles('mediameta');
92                            foreach ($config_files as $config_file) {
93                                if(@file_exists($config_file)) {
94                                    include($config_file);
95                                }
96                            }
97
98                            foreach($fields as $key => $tag){
99                                $t = array();
100                                if (!empty($tag[0])) {
101                                    $t = array($tag[0]);
102                                }
103                                if(is_array($tag[3])) {
104                                    $t = array_merge($t,$tag[3]);
105                                }
106                                $value = tpl_img_getTag($t);
107                                if ($value) {
108                                    echo '<dt>'.$lang[$tag[1]].':</dt><dd>';
109                                    if ($tag[2] == 'date') {
110                                        echo dformat($value);
111                                    } else {
112                                        echo hsc($value);
113                                    }
114                                    echo '</dd>';
115                                }
116                            }
117
118                            $t_array = media_inuse(tpl_img_getTag('IPTC.File.Name',$IMG));
119                            if (isset($t_array[0])) {
120                                echo '<dt>'.$lang['reference'].':</dt>';
121                                foreach ($t_array as $t) {
122                                    echo '<dd>'.html_wikilink($t,$t).'</dd>';
123                                }
124                            }
125                        ?>
126                    </dl>
127                    <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw'));?>
128                </div>
129                <div class="clearer"></div>
130            </div><!-- /.content -->
131
132            <p class="back">
133                <?php
134                    $imgNS = getNS($IMG);
135                    $authNS = auth_quickaclcheck("$imgNS:*");
136                    if (($authNS >= AUTH_UPLOAD) && function_exists('media_managerURL')) {
137                        $mmURL = media_managerURL(array('ns' => $imgNS, 'image' => $IMG));
138                        echo '<a href="'.$mmURL.'">'.$lang['img_manager'].'</a><br />';
139                    }
140                ?>
141                &larr; <?php echo $lang['img_backto']?> <?php tpl_pagelink($ID)?>
142            </p>
143
144        <?php } ?>
145    </div>
146</body>
147</html>
148
149