]> git.defcon.no Git - plsgen/blob - index.php
Three new features, three bugfixes. Version 0.4 code.
[plsgen] / index.php
1 <?php
2 $pagetitle = "Example photoalbum.";
3 $css_file = 'indexstyle.css';
4 $parent_url = "http://example.com";
5 $parent_linktext = "UPDATE index.php";
6 $contact_address = "someone@example.com";
7
8 //define the path as relative
9 $path = "./";
10
11 //using the opendir function
12 $dir_handle = @opendir($path) or die("Unable to open $path");
13
14 //running the while loop
15 while ($file = readdir($dir_handle)) {
16 $target = $path . $file;
17 if (($file != "images") && ($file != "generate") && ($file != ".") && ($file != "..")) {
18 if(file_exists($target)) {
19 if (!is_file($target)) {
20 if (is_file($target . "/.title")) {
21 $fd = fopen($target . "/.title", "r");
22 $buf = "";
23 $buf = fgets($fd, 4096);
24 fclose($fd);
25 $album[$file] = "<span class='strong'>" . $buf . "</span>";
26 }
27
28 if (is_file($target . "/.indeximage")) {
29 $fd = fopen($target . "/.indeximage", "r");
30 $buf = $file . "/thumb/";
31 $buf .= fgets($fd, 4096);
32 chop ($buf);
33 fclose($fd);
34 $idximage[$file] = "<img src='" . $buf . "' alt='Thumb' />";
35 }
36
37 } else {
38
39 }
40 }
41 }
42 }
43 //closing the directory
44 closedir($dir_handle);
45
46 krsort($album);
47 ?>
48 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
49 <html xmlns="http://www.w3.org/1999/xhtml">
50 <head>
51 <title><?=$pagetitle?></title>
52
53 <link rel='stylesheet' href='<?=$css_file?>' type='text/css' />
54 <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
55
56 </head>
57 <body>
58 <div id="wrapper">
59 <div id="head">
60 <h1><?=$pagetitle?></h1>
61 <a style="display: block; float: right;" href="rss.php"><img src="images/rss_icon.png" alt="RSS" border="0" /></a>
62
63 <div id="head-link"><a href="<?=$parent_url?>"><?=$parent_linktext?></a>
64 <br/>
65 <a href="latest.php">Latest updates</a>
66 </div>
67 </div>
68 <div id="content">
69
70
71 <?php
72 foreach ( $album as $key => $value ) {
73 echo "<div class='album'>";
74 echo "<div class='idxthumb'>";
75 echo "<a target='_blank' href='" . $key . "'>";
76 echo $idximage[$key];
77 echo "</a>";
78 echo "</div>";
79 echo "<div class='idxlink'>";
80 echo "<a target='_blank' href='" . $key . "'>" . $key . "</a>\n";
81 echo "</div>";
82 echo "<div class='title'>$value</div>";
83 echo "</div>";
84 }
85 ?>
86 </div>
87 </div>
88 <div style="font-family: sans; font-size: 7pt; color: #444; margin-top: 20px;">
89 <a href="http://wiki.defcon.no/projects/plsgen">plsgen : Perl Simple Gallery Generator</a>
90 </div>
91 </body>
92 </html>