--- /dev/null
+# BEGIN s9y
+ErrorDocument 404 /index.php
+ErrorDocument 403 /maint.txt
+#Order deny,allow
+#deny from all
+#allow from 121.73.3.252
+<Files maint.txt>
+ allow from all
+</Files>
+#<Files *>
+# order deny,allow
+# deny from 125.239.42.165
+# ErrorDocument 403 /abuse.txt
+#</Files>
+<Files comment.php>
+ deny from all
+</Files>
+<Files abuse.txt>
+ allow from all
+</Files>
+
+# DirectoryIndex /index.php
+
+RewriteEngine On
+RewriteBase /
+RewriteRule ^stats/.*$ - [L]
+RewriteRule ^(archives/([0-9]+)-[0-9a-z\.\_!;,\+\-]+\.html) index.php?/$1 [NC,L,QSA]
+RewriteRule ^(authors/([0-9]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [NC,L,QSA]
+RewriteRule ^(feeds/categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+\.rss) index.php?/$1 [NC,L,QSA]
+RewriteRule ^(feeds/authors/([0-9]+)-[0-9a-z\.\_!;,\+\-]+\.rss) index.php?/$1 [NC,L,QSA]
+RewriteRule ^(categories/([0-9;]+)-[0-9a-z\.\_!;,\+\-]+) index.php?/$1 [NC,L,QSA]
+RewriteRule ^archives([/A-Za-z0-9]+)\.html index.php?url=/archives/$1.html [NC,L,QSA]
+RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
+RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
+RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
+RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
+RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
+RewriteRule ^(admin|entries)(/.+)? index.php?url=admin/ [L,QSA]
+RewriteRule ^archive/? index.php?url=/archive [L,QSA]
+RewriteRule ^(index|atom[0-9]*|rss|b2rss|b2rdf).(rss|rdf|rss2|xml) rss.php?file=$1&ext=$2
+RewriteRule ^(plugin|plugin)/(.*) index.php?url=$1/$2 [L,QSA]
+RewriteRule ^search/(.*) index.php?url=/search/$1 [L,QSA]
+RewriteRule ^(serendipity\.css|serendipity_admin\.css) index.php?url=/$1 [L,QSA]
+RewriteRule ^index\.(html?|php.+) index.php?url=index.html [L,QSA]
+RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
+RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]
+
+<Files *.tpl.php>
+ deny from all
+</Files>
+
+<Files *.tpl>
+ deny from all
+</Files>
+
+<Files *.sql>
+ deny from all
+</Files>
+
+<Files *.inc.php>
+ deny from all
+</Files>
+
+<Files *.db>
+ deny from all
+</Files>
+
+# END s9y
+
--- /dev/null
+My cat likes to hide in boxes!
\ No newline at end of file
--- /dev/null
+She fits in a guitar case.
\ No newline at end of file
--- /dev/null
+This stick looks like it might be fun to play with....
\ No newline at end of file
--- /dev/null
+But I can't quite reach it....
\ No newline at end of file
--- /dev/null
+Maybe if I just jump up and show my incredibly cute tummy?
\ No newline at end of file
--- /dev/null
+My cat is extremely cute. Sometimes she's so cute and squishy I want to squeeze her until blood comes out.
\ No newline at end of file
--- /dev/null
+Martin D took these ridiculous photos with some weird new mac os x thing I haven't seen before
--- /dev/null
+I made this jeans one new years. I was so hungover I made the waistband about 10cm too big and had to completely unmake it and redo it about a week later when I had recovered.
\ No newline at end of file
--- /dev/null
+I made this funny hat for <a href="http://stala.co.nz">my Jo girl</a>. It has a tie in it!
\ No newline at end of file
--- /dev/null
+I made this necklace for my mother
\ No newline at end of file
--- /dev/null
+I made this ring for my flatmate for her birthday
\ No newline at end of file
--- /dev/null
+When I have time, I make clothes and jewellery.
\ No newline at end of file
--- /dev/null
+We put the finishing touches on the board game with the help of Andrew's children
\ No newline at end of file
--- /dev/null
+The finished product!
\ No newline at end of file
--- /dev/null
+Chris has been given a portable tanty zone
\ No newline at end of file
--- /dev/null
+I don't know what is happening here, obviously somebody did something clever
\ No newline at end of file
--- /dev/null
+Michelle knows the answer, but I suspect it is not her turn.
\ No newline at end of file
--- /dev/null
+Mary has received a punishment that says:
+Slap yourself in the face
+... and do it again
+... and again
+... and again
+... and again
\ No newline at end of file
--- /dev/null
+I'm not sure what is happening here and clearly it is horribly out of focus but I find it amusing nonetheless
\ No newline at end of file
--- /dev/null
+We have been given prizes from a forage around the neighbourhood.
\ No newline at end of file
--- /dev/null
+Closeup of us with our prizes
\ No newline at end of file
--- /dev/null
+Mikey had to talk for two minutes about how knowing Penny and Chris has influenced his life for the better
\ No newline at end of file
--- /dev/null
+We listen to Mikey telling us how wonderful we are
\ No newline at end of file
--- /dev/null
+We are so pleased with Mikey we let him move forward two squares and have another go. Mikey is pleased.
\ No newline at end of file
--- /dev/null
+Not everyone is enthusiastic about the game. These three don't seem to think it's as great as we do.
\ No newline at end of file
--- /dev/null
+Horribly out of focus, but needed to be documented! Chris licks Simon's armpit.
\ No newline at end of file
--- /dev/null
+Wifey love. I look terrified.
\ No newline at end of file
--- /dev/null
+Lisa had to eat the envelope the punishment came in.
\ No newline at end of file
--- /dev/null
+We love the game!
\ No newline at end of file
--- /dev/null
+I imagine the words coming out of my mouth are something or other OF DOOOOM
\ No newline at end of file
--- /dev/null
+The high starts to wear off for me, Chris is still going strong with the questions
\ No newline at end of file
--- /dev/null
+Shanna watches in amusement
\ No newline at end of file
--- /dev/null
+We think we're having a GREAT birthday
\ No newline at end of file
--- /dev/null
+I am a star bellied Leach. I woke up like this and was alarmed in the morning.
\ No newline at end of file
--- /dev/null
+Found in the freezer in the morning. I suspect this was part of the great underwear swapping one team got as a punishment. They did actually trade it for something else, but Simon got a little carried away.
\ No newline at end of file
--- /dev/null
+Mine and Chris's joint birthday party 2006
--- /dev/null
+I got to mojo to find nougat with three candles (turning 27 = 3<sup>3</sup>), a doppio, a box of chocolate coffee beans, and a birthday balloon.
--- /dev/null
+We do our best to upset the waiting crowd outside the World Press Photo Exhibit after breakfast
--- /dev/null
+Mischief Bad Group
--- /dev/null
+I stood on this! eep!
--- /dev/null
+This is the wanky airbrushed photo of me I use for articles and conference presentations and stuff.
--- /dev/null
+Pictures of tattoo before and after latest shading work.
--- /dev/null
+The really scary thing about this photo is, that apart from the blond curls and the overalls,<br>I look <i>exactly the same</i>.
--- /dev/null
+<?
+$content .= 'The really scary thing about this photo is, that apart from the blond curls and the overalls,<br>I look <i>exactly the same</i>.';
+?>
\ No newline at end of file
--- /dev/null
+We run out of wine, Anna makes rum and coke
--- /dev/null
+I have no idea why we thought this was a good idea, but here we are quite drunk with pots on our head
--- /dev/null
+Again with the pot on head
--- /dev/null
+Far too hot, we start drinking beer in the early afternoon
--- /dev/null
+This pretty much sums up the first 2 days in Auckland. Beer and guitars
--- /dev/null
+Anna poses for the camera
--- /dev/null
+Anna gives Megan a wedgie
--- /dev/null
+Megan is bred for her skills in magic
--- /dev/null
+I lie in the sun on the deck
--- /dev/null
+My feet on Megan
--- /dev/null
+We don't last long before we start singing
--- /dev/null
+Someone is showing photos of something funny
--- /dev/null
+Amazing how comfortable we all are with eachother after the four of us not being in the same room at the same time for 10 years, we guess
--- /dev/null
+Megan wanted to take this back to Venice to shock the natives with our manner of drinking
--- /dev/null
+I take photos of Megan in her underwear getting ready for bed and threaten to put them on teh intawebs, she takes this photo while I roll about in hysterics
--- /dev/null
+Me looking washed out on the ferry to Devonport
--- /dev/null
+We are SO good at taking photos of ourselves, it only took about 10 tries
--- /dev/null
+Sunset in Kaukapakapa on my first night there
--- /dev/null
+Beautiful sisters
--- /dev/null
+I suck at doing panorama but this gives the broad idea of where we sat and drank wine
--- /dev/null
+Taken by M
--- /dev/null
+Taken by M
--- /dev/null
+Taken by M
--- /dev/null
+Council flats
--- /dev/null
+Admittedly I'm not vegan anymore, but it still made me happy
--- /dev/null
+Bypass mess
--- /dev/null
+Bypass mess
--- /dev/null
+<?
+
+$file = $_GET['f'];
+require_once(dirname(dirname(__FILE__)).'/serendipity_config.inc.php');
+require_once(S9Y_INCLUDE_PATH.'plugins/serendipity_plugin_gallery/lib.php');
+
+echo '
+<html>
+ <head>
+ <title>view image</title>
+ <link rel="stylesheet" type="text/css" href="'.$serendipity['baseURL'].'templates/sgn/style.css" />
+ </head>
+ <body>
+';
+
+
+$file = sanitize_filename($file);
+
+if (file_exists(SGN_DIR_ROOT.$file)) {
+ $caption = '';
+ $f = explode('.',$file);
+ if (file_exists(SGN_DIR_ROOT.str_replace($f[count($f)-1],'inc',$file))) {
+ $caption = implode('',file(SGN_DIR_ROOT.str_replace($f[count($f)-1],'inc',$file)));
+ }
+ echo '<p align="center"><img src="'.SGN_WEB_ROOT.$file.'" alt="'.strip_tags($caption).'" /></p>'
+ .'<p align="center">'.$caption.'</p>'
+ .'<p align="center">';
+ if ($prev = has_prev_image($file)) {
+ echo '<a href="/gallery/view.php?f='.$prev.'">prev</a> | ';
+ }
+ echo '<a href="/gallery/show'.substr($file,0,strrpos($file,'/')).'">dir</a>';
+ if ($next = has_next_image($file)) {
+ echo ' | <a href="/gallery/view.php?f='.$next.'">next</a> ';
+ }
+ echo '</p>';
+}
+?>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?php
+$serendipity['smarty']->assign('content_message','
+<h3 class="serendipity_date">about</h3>
+<p>A long list of not very interesting facts about me, in no particular order:</p>
+<ul>
+<li>I live in Wellington, New Zealand</li>
+<li>I was born in Dunedin, New Zealand on the 19th of April, 1980</li>
+<li>I work at <a href="http://catalyst.net.nz">Catalyst IT</a></li>
+<li>As a dirty, dirty nerd</li>
+<li>I feel the cold, and love electric blankets, heaters, and fires</li>
+<li>I like mod_rewrite a whole lot</li>
+<li>I have a cat called Nothing, named after a character in a book I read when I was 16</li>
+<li>I live with one other person, she has two cats</li>
+<li>That makes three cats</li>
+<li>I like my mail to arrive at least digitally signed</li>
+<li>I have visible tattoos and piercings</li>
+<li>I prefer postgres to mysql</li>
+<li>One thing that makes me really, really happy is to wake up in the morning after a storm, and have From the Edge of The Deep Green Sea by The Cure stuck in my head</li>
+<li>Mac hardware == hottt. I am a macwhore</li>
+<li>I like Open Source. Right now I am interested in <a href="http://moodle.org">Moodle</a>, <a href="http://elgg.net">Elgg</a>, and <a href="http://eduforge.org">Eduforge</a>, and am trying to find time to be more interested in <a href="http://debian.org">Debian</a></li>
+<li>I am generally reading about 4 or 5 books at any given time</li>
+<li>My parents are both archaeologists, I grew up with weird artifacts in my house that my friends laughed at</li>
+<li>I went to boarding school, and I hated it</li>
+<li>I was vegan for a year and a half, and vegetarian on-and-off for about 5. Now I am a shameless meatmouth</li>
+<li>I make clothes and jewellery</li>
+<li>I still use tables for layout in HTML</li>
+<li>Spelling errors make me really embarrassed</li>
+<li>I generally play at least 3 games of foosball every day. I prefer to play attack</li>
+<li>I try and convince everyone I know that they should install Linux, preferably Debian</li>
+<li>Which often means I end up being a one-woman helpdesk</li>
+<li>My favourite book is Still Life with Woodpecker, by Tom Robbins</li>
+<li>Give me <span class="mono">emacs</span> over <span class="mono">vi</span> any day</li>
+<li>When I\'m really tired, I often incorporate the alarm clock noise into my dream and keep sleeping</li>
+<li>(Obviously) I like lists</li>
+<li>I <i>do not</i> like it when people end a parenthesised sentence with a smiley face (like this ;)</li>
+</ul>
+');
+
+
+
+
+?>
'{PAT_PERMALINK_AUTHORS}',
'{PAT_PERMALINK_FEEDCATEGORIES}',
'{PAT_PERMALINK_CATEGORIES}',
- '{PAT_PERMALINK_FEEDAUTHORS}'
+ '{PAT_PERMALINK_FEEDAUTHORS}',
+ '{PAT_ABOUT}', '{PATH_ABOUT}',
+ '{PAT_GALLERY}','{PATH_GALLERY}',
+
),
array(
trim($PAT['PERMALINK_AUTHORS'], '@/i'),
trim($PAT['PERMALINK_FEEDCATEGORIES'], '@/i'),
trim($PAT['PERMALINK_CATEGORIES'], '@/i'),
- trim($PAT['PERMALINK_FEEDAUTHORS'], '@/i')
+ trim($PAT['PERMALINK_FEEDAUTHORS'], '@/i'),
+ trim($PAT['ABOUT'], '@/i'), $serendipity['permalinkAboutPath'],
+ trim($PAT['GALLERY'],'@/i'), $serendipity['permalinkGalleryPath'],
),
implode('', $a)
fwrite($fp, $match[1] . $content . $match[2]);
} else {
fwrite($fp, $content);
+ error_log('writing to file');
}
fclose($fp);
return true;
$serendipity['permalinkCommentsPath'] = 'comments';
}
+ if (!isset($serendipity['permalinkAboutPath'])) {
+ $serendipity['permalinkAboutPath'] = 'about';
+ }
+
+ if (!isset($serendipity['permalinkGalleryPath'])) {
+ $serendipity['permalinkGalleryPath'] = 'gallery';
+ }
+
/* URI paths
* These could be defined in the language headers, except that would break
* backwards URL compatibility
*/
+ @define('PATH_ABOUT', $serendipity['permalinkAboutPath']);
+ @define('PATH_GALLERY', $serendipity['permalinkGalleryPath']);
@define('PATH_ARCHIVES', $serendipity['permalinkArchivesPath']);
@define('PATH_ARCHIVE', $serendipity['permalinkArchivePath']);
@define('PATH_CATEGORIES', $serendipity['permalinkCategoriesPath']);
* If you add new patterns, remember to add the new rules to the *.tpl files and
* function serendipity_installFiles().
*/
+ @define('PAT_ABOUT', '@/'.PATH_ABOUT.'/?@');
+ @define('PAT_GALLERY','@/'.PATH_GALLERY.'/(.*)@');
@define('PAT_FILENAME', '0-9a-z\.\_!;,\+\-\%');
@define('PAT_FILENAME_MATCH', '[' . PAT_FILENAME . ']+');
@define('PAT_CSS', '@/(serendipity\.css|serendipity_admin\.css)@');
$PAT = array();
+ $PAT['ABOUT'] = '@/' . $serendipity['permalinkAboutPath'];
+ $PAT['GALLERY'] = '@/' . $serendipity['permalinkGalleryPath'];
$PAT['UNSUBSCRIBE'] = '@/' . $serendipity['permalinkUnsubscribePath'].'/(.*)/([0-9]+)@';
$PAT['APPROVE'] = '@/' . $serendipity['permalinkApprovePath'].'/(.*)/(.*)/([0-9]+)@';
$PAT['DELETE'] = '@/' . $serendipity['permalinkDeletePath'].'/(.*)/(.*)/([0-9]+)@';
--- /dev/null
+<?php
+
+require_once(S9Y_INCLUDE_PATH.'plugins/serendipity_plugin_gallery/lib.php');
+
+// uriargs[0] should always be gallery
+// uriargs[1] can either be show, expand, collapse, view
+// the rest of the array is the actual useful stuff.
+
+$uriargs = explode('/',$_SERVER['REQUEST_URI']);
+
+$start = 0;
+$relevantargs = array();
+foreach ($uriargs as $arg) {
+ if ($arg == 'gallery') {
+ $start = 1;
+ }
+ if (empty($start)) {
+ continue;
+ }
+ $relevantargs[] = $arg;
+}
+
+$cmd = $relevantargs[1];
+
+$args = '';
+for ($i = 2; $i < count($relevantargs); $i++) {
+ $args .= '/'.$relevantargs[$i];
+}
+
+if ($cmd == 'show') {
+ $show = $args;
+}
+if (empty($show)) {
+ $show = (isset($_SESSION['show'])) ? $_SESSION['show'] : '';
+}
+$_SESSION['show'] = $show;
+
+if ($cmd == 'expand') {
+ $expand = $args;
+}
+if (empty($expand)) {
+ $expand =(isset($_SESSION['expand'])) ? $_SESSION['expand'] : '';
+}
+$_SESSION['expand'] = $expand;
+
+$expanded = $_SESSION['expanded'];
+if (empty($expanded)) {
+ $expanded = array();
+}
+$expanded[$expand] = 1;
+
+if ($cmd == 'collapse') {
+ $collapse= $args;
+}
+if (!empty($collapse)) {
+ $expanded[$collapse] = 0;
+}
+$_SESSION['expanded'] = $expanded;
+
+if ($cmd == 'search') {
+ $content = make_search($args);
+}
+else if ($cmd == 'view') {
+ $file = sanitize_filename($args);
+
+ if (file_exists(SGN_DIR_ROOT.$file)) {
+ $caption = '';
+ $f = explode('.',$file);
+ if (file_exists(SGN_DIR_ROOT.str_replace($f[count($f)-1],'inc',$file))) {
+ $caption = implode('',file(SGN_DIR_ROOT.str_replace($f[count($f)-1],'inc',$file)));
+
+ }
+ $content .= '<p align="center"><img src="'.SGN_WEB_ROOT.$file.'" alt="'.strip_tags($caption).'" /></p>'
+ .'<p align="center">'.$caption.'</p>';
+
+ }
+} else {
+ $content = make_directory($show);
+}
+
+$serendipity['smarty']->assign('content_message',$content);
+
+
+?>
\ No newline at end of file
case 'archives':
serendipity_printArchives();
break;
+ case 'about':
+ include_once(S9Y_INCLUDE_PATH.'include/about.inc.php');
+ break;
+ case 'gallery':
+ include_once(S9Y_INCLUDE_PATH.'include/gallery.inc.php');
+ break;
// Welcome screen or whatever
default:
RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
+RewriteRule ^{PAT_ABOUT} {indexFile}?url=/{PAT_ABOUT}/ [L,QSA]
RewriteRule (.*\.html?) {indexFile}?url=/$1 [L,QSA]
<Files *.tpl.php>
$css_mode = $matches[1];
include(S9Y_INCLUDE_PATH . 'serendipity.css.php');
exit;
+} else if (preg_match(PAT_ABOUT, $uri, $matches)) {
+ $serendipity['GET']['action'] = 'about';
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
+} else if (preg_match(PAT_GALLERY, $uri, $matches)) {
+ $serendipity['GET']['action'] = 'gallery';
+ include_once(S9Y_INCLUDE_PATH . 'include/genpage.inc.php');
} else if (preg_match(PAT_COMMENTS, $uri, $matches)) {
$serendipity['view'] = 'comments';
$_args = serendipity_getUriArguments($uri, true); // Need to also match "." character
--- /dev/null
+<?php
+
+@define('SGN_DIR_ROOT',$serendipity['serendipityPath'].'gallery/images');
+@define('SGN_WEB_ROOT',$serendipity['baseURL'].'gallery/images');
+
+
+function make_tree($start,$indent,$show,$expand,$expanded) {
+ global $serendipity;
+ $spacer = serendipity_getTemplateFile('img/spacer.gif');
+ $plus = serendipity_getTemplateFile('img/plus.gif');
+ $minus = serendipity_getTemplateFile('img/minus.gif');
+ $plusGrey = serendipity_getTemplateFile('img/plusGrey.gif');
+ $minusGrey = serendipity_getTemplateFile('img/minusGrey.gif');
+
+ $children = get_children($start);
+
+
+ foreach ($children as $path => $name) {
+ echo '<img src="'.$spacer.'" height="1" width="'.$indent.'" />';
+ if ($expanded[$path] == 1) {
+ echo '<a href="'.$serendipity['baseURL'].'gallery/collapse'.$path.'"><img src="'.$minus.'" alt="expand" /></a> '."\n";
+ if ($show != $path) {
+ echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n";
+ }
+ else {
+ echo '<span class="selected">'.stripslashes($name).'</span><br />'."\n";
+ }
+ make_tree($path,$indent+10,$show,$expand,$expanded);
+ }
+ else {
+ if (has_children($path)) {
+ echo '<a href="'.$serendipity['baseURL'].'gallery/expand'.$path.'"><img src="'.$plus.'" alt="expand" /></a> '."\n";
+ }
+ else {
+ echo '<img src="'.$plusGrey.'" alt="No children" /> '."\n";
+ }
+ if ($show != $path) {
+ echo '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.stripslashes($name).'</a><br />'."\n";
+ }
+ else {
+ echo '<span class="selected">'.stripslashes($name).'</span><br />'."\n";
+ }
+ }
+ }
+}
+
+
+function has_children($path) {
+ global $serendipity;
+ $children = get_children($path);
+ if (!empty($children) || count($children)) {
+ return true;
+ }
+ return false;
+}
+
+
+function get_children($path) {
+ global $serendipity;
+ $fullpath = SGN_DIR_ROOT.$path;
+ $children = array();
+ $dir = opendir($fullpath);
+ while (false !== ($file = readdir($dir))) {
+ if (substr($file,0,1) == '.') { // hide hidden
+ continue;
+ }
+ if (!is_dir($fullpath.'/'.$file)) {
+ continue;
+ }
+ if ($path{strlen($path) -1} != '/') {
+ $path = $path.'/';
+ }
+ $children[$path.$file] = $file;
+ }
+ return $children;
+
+}
+
+
+function make_search($query) {
+ global $serendipity;
+
+}
+
+
+function make_directory($show) {
+ global $serendipity;
+ $content .='<div style="padding-left:20px">';
+ $content .='<p><b>showing images in: '.get_heading($show).':</b></p>';
+ if (file_exists(SGN_DIR_ROOT.$show.'/summary.inc')) {
+ $content .='<p>»» ';
+ $content .= implode('',file(SGN_DIR_ROOT.$show.'/summary.inc'));
+ $content .='</p>';
+ }
+ $files = get_images($show);
+ if (!is_array($files) || !count($files)) {
+ $content .='<p>»» No images!</p>';
+ $content .='</div>';
+ }
+ else {
+ $content .='</div>';
+ $content .='<table cellpadding="20"><tr>';
+ $count = 1;
+ foreach ($files as $file) {
+ $thumb = get_thumb($show,$file);
+ $f = explode('.',$file);
+ $caption = '';
+ if (file_exists(SGN_DIR_ROOT.$show.str_replace($f[count($f)-1],'inc',$file))) {
+ $caption = implode('',file(SGN_DIR_ROOT.$show.str_replace($f[count($f)-1],'inc',$file)));
+ }
+ $content .='<td><a href="'.$serendipity['baseURL'].'gallery/view.php?f='.$show.'/'.$file.'"><img src="'.SGN_WEB_ROOT.$thumb.'" alt="'.$caption.'" /></a></td>';
+ if ($count == 3) {
+ $content .='</tr><tr>';
+ $count = 1;
+ }
+ else {
+ $count++;
+ }
+ }
+ $content .='</tr></table>';
+ }
+ $content .='<div style="padding-left:20px">';
+ $content .='<p><b>subdirectories:</b></p>';
+
+ $children = get_children($show);
+
+ if (count($children)) {
+ foreach ($children as $path => $child) {
+ $content .='<p>»» <a href="'.$serendipity['baseURL'].'gallery/show'.$path.'">'.$child.'</a>';
+ if (file_exists(SGN_DIR_ROOT.$path.'/summary.inc')) {
+ $content .='<br />'
+ .implode('',file(SGN_DIR_ROOT.$path.'/summary.inc'));
+ }
+ $content .='</p>';
+ }
+ } else {
+ $content .='<p>No children</p>';
+ }
+ $content .='</div>';
+ return $content;
+}
+
+function get_heading($str) {
+ global $serendipity;
+ $dirs = explode('/',$str);
+ $newstr = '';
+ foreach ($dirs as $index => $dir) {
+ $path = '';
+ for ($i = 0; $i < $index; $i++) {
+ $path .= $dirs[$i].'/';
+ }
+ $newstr .= '<a href="'.$serendipity['baseURL'].'gallery/show'.$path.$dir.'">'.$dir.'</a>/';
+ }
+ return $newstr;
+}
+
+
+function get_images($path) {
+ global $serendipity;
+ $fullpath = SGN_DIR_ROOT.$path;
+ $children = array();
+ $dir = opendir($fullpath);
+ while (false !== ($file = readdir($dir))) {
+ if (substr($file,0,1) == '.') { // hide hidden
+ continue;
+ }
+ if (is_dir($fullpath.'/'.$file)) {
+ continue;
+ }
+ $f = explode('.',$file);
+ if ($f[count($f)-1] == 'inc') {
+ continue;
+ }
+ if ($f[count($f)-2] == 'thumb') {
+ continue;
+ }
+ if ($file{strlen($file)-1} == '~') {
+ // naughty emacs
+ continue;
+ }
+ if ($path{strlen($path) -1} != '/') {
+ $path = $path.'/';
+ }
+ $children[$path.$file] = $file;
+ }
+ return $children;
+}
+
+function get_thumb($path,$filename) {
+ global $serendipity;
+
+ $f = explode('.',$filename);
+ $thumbname = $path.'/'.str_replace($f[count($f)-1],'thumb.'.$f[count($f)-1],$filename);
+
+ if (file_exists(SGN_DIR_ROOT.$thumbname)) {
+ return $thumbname;
+ }
+
+
+ // set up some config variables
+ $width = 100; // max width of thumb
+ $height = 100; // max height of thumb
+
+ $view = SGN_DIR_ROOT.$path.'/'.$filename;
+
+ $extn = strtolower(substr($filename, -3));
+ switch($extn) {
+ case 'jpg':
+ $old = @ImageCreateFromJPEG($view);
+ break;
+
+ case 'png':
+ $old = @ImageCreateFromPNG($view);
+ break;
+ }
+
+
+ if (empty($old)) {
+ return false;
+ } else {
+ $old_x = ImageSX($old);
+ $old_y = ImageSY($old);
+
+ // make new thumbnail
+ if ($old_y > $old_x) {
+ $new_y = $height; // max height of thumb
+ $new_x = ($old_x * $new_y)/$old_y; // retain aspect ratio
+ }
+ else {
+ $new_x = $width; // max width of thumb
+ $new_y = ($old_y * $new_x)/$old_x; // retain aspect ratio
+ }
+ // $new = ImageCreate($new_x, $new_y);
+ $new = ImageCreateTrueColor($new_x, $new_y);
+ @ImageCopyResized($new, $old, 0, 0, 0, 0, $new_x, $new_y, $old_x, $old_y);
+ }
+
+ imageInterlace($new);
+ touch(SGN_DIR_ROOT.$thumbname);
+ $result = ImagePNG($new,SGN_DIR_ROOT.$thumbname);
+ return $thumbname;
+}
+
+function sanitize_filename($file) {
+ global $serendipity;
+ $path = explode('/',$file);
+ $return = '';
+ foreach ($path as $p) {
+ if ($p != '..') {
+ $return .= $p.'/';
+ }
+ }
+ return substr($return,0,-1);
+
+}
+
+
+function has_next_image($file) {
+ $images = get_images(substr($file,0,strrpos($file,'/')));
+ $count = 0;
+ $ret = false;
+ foreach ($images as $k => $v) {
+ if (!empty($ret)) {
+ return $k;
+ }
+ if ($k == $file) {
+ if ($count != count($images)-1) {
+ $ret = true;
+ }
+ }
+ $count++;
+ }
+ return false;
+}
+
+function has_prev_image($file) {
+ $images = get_images(substr($file,0,strrpos($file,'/')));
+ $count = 0;
+ $ret = false;
+ foreach ($images as $k => $v) {
+ if ($k == $file) {
+ if (!empty($ret)) {
+ return $ret;
+ }
+ }
+ $ret = $k;
+ $count++;
+ }
+ return false;
+}
+
+
+?>
--- /dev/null
+<?php # $Id: serendipity_plugin_comments.php 7 2005-04-16 06:39:31Z s_bergmann $
+require_once('lib.php');
+
+// Probe for a language include with constants. Still include defines later on, if some constants were missing
+$probelang = dirname(__FILE__) . '/lang_' . $serendipity['lang'] . '.inc.php';
+if (file_exists($probelang)) {
+ include $probelang;
+}
+
+switch ($serendipity['lang']) {
+ case 'en':
+ default:
+ @define('PLUGIN_GALLERY','Image gallery');
+ @define('PLUGIN_GALLERY_BLAHBLAH', 'Embedded image gallery');
+ break;
+}
+
+class serendipity_plugin_gallery extends serendipity_plugin
+{
+ var $title = PLUGIN_GALLERY;
+
+ function introspect(&$propbag)
+ {
+ global $serendipity;
+
+ $propbag->add('name', PLUGIN_GALLERY);
+ $propbag->add('description', PLUGIN_GALLERY_BLAHBLAH);
+ $propbag->add('stackable', true);
+ $propbag->add('author', 'Penny Leach');
+ $propbag->add('version', '1.0');
+ $propbag->add('requirements', array(
+ 'serendipity' => '0.8',
+ 'smarty' => '2.6.7',
+ 'php' => '4.1.0'
+ ));
+ }
+
+ function generate_content(&$title)
+ {
+ global $serendipity;
+ $title = $this->title;
+
+
+ $show = $_GET['show'];
+ if (!isset($show)) {
+ $show = (isset($_SESSION['show'])) ? $_SESSION['show'] : '';
+ }
+ $_SESSION['show'] = $show;
+ $expand = $_GET['expand'];
+ if (!isset($_GET['expand'])) {
+ $expand =(isset($_SESSION['expand'])) ? $_SESSION['expand'] : '';
+ }
+ $_SESSION['expand'] = $expand;
+ $expanded = $_SESSION['expanded'];
+ if (!isset($expanded)) {
+ $expanded = array();
+ }
+ $expanded[$expand] = 1;
+ $collapse= $_GET['collapse'];
+ if (isset($collapse)) {
+ $expanded[$collapse] = 0;
+ }
+ $_SESSION['expanded'] = $expanded;
+ $op = $_GET['op'];
+
+ make_tree('/',1,$show,$expand,$expanded);
+ }
+
+}
+
+
+/* vim: set sts=4 ts=4 expandtab : */
+?>