3 $iniarray=parse_ini_file("config.ini");
4 $webbase=$iniarray["webbase"];
5 $dbprefix=$iniarray["dbprefix"];
6 $admin=$iniarray["admin"];
7 $title=$iniarray["title"];
8 $N=$iniarray["pics_per_page"];
9 /* end parse ini-file */
12 if(isset($_REQUEST["page"]))
13 $page = intval($_REQUEST["page"]);
17 if(isset($_REQUEST["tag"]))
18 $tags = htmlentities($_REQUEST["tag"]);
22 if(isset($_REQUEST["pic"]))
23 $pic = intval(htmlentities($_REQUEST["pic"]));
28 /* autoversioning of js and css files */
29 function autoversion($file)
31 /* changes the file name of e.g. css/style.css to css/style.<md5>.css/js
32 * this way the browser can cache the file and will reload it if the file changed
33 * needs to have .htaccess set up correctly to link back to css/style.css */
35 /* only use it for file that have an absolut path */
36 if(!file_exists(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file))
39 $md5 = md5_file(dirname($_SERVER['SCRIPT_FILENAME']). '/' . $file);
40 return preg_replace('{\\.([^./]+)$}', ".$md5.\$1", $file);
43 /* The basic layout */
47 <title><?php echo htmlspecialchars($title) ?></title>
48 <script src = "<?php echo $webbase.autoversion("/js/d3.min.js")?>"></script>
49 <link rel="stylesheet" type="text/css" href="<?php echo $webbase.autoversion("/css/normalize.css")?>" />
50 <link rel="stylesheet" type="text/css" href="<?php echo $webbase.autoversion("/css/style.css")?>" />
54 <div class="debug"></div>
55 <h1><?php echo htmlspecialchars($title) ?></h1>
58 page <span class="index"></span>
59 <button class="prev" type="button" disabled="disabled" onclick="prev_page()"> prev </button>
60 <button class="next" type="button" onclick="next_page()">next </button>
61 <button class="all" type="submit" onclick="document.location.href='<?php echo $webbase?>'">all</button>
64 <div class="permalink"></div>
66 <div class="tagsearch">
67 <form method="get" action="">
68 Search for tag: <input list="MyTags" id="MyTagsInput" type="text" value="" />
69 <datalist id="MyTags">
72 Current tags:<span id="currenttags"></span>
73 <button class="next" type="button" onclick="tagcloud()">tag cloud</button>
76 <div class="nextprev"> <ul></ul></div>
78 <div class="pics"><ul></ul> </div>
81 This gallery belongs to <?php echo htmlspecialchars($admin) ?>.
82 <div class="copyright"> photo-tags: copyright 2011 Arun Persaud arun@nubati.net, code available at <a href="http://source.nubati.net/projects/photo-tags">source.nubati.net/projects/photo-tags</a></div>
86 <script src = "<?php echo $webbase.autoversion("/js/photo-tags.js")?>"></script>
87 <script type="text/javascript" >
89 /*hand parameters over to javascript*/
90 var page=<?php echo $page ?>;
91 var N=<?php echo $N ?>;
92 var T="<?php echo $tags ?>";
93 var ID=<?php echo $pic ?>;
95 var dbprefix="<?php echo $dbprefix ?>".replace(/\//g,"\/");
96 var webbase = "<?php echo $webbase?>";