1024 && count($sxlist) >= 2) { array_shift($sxlist); $size /= 1024; } return number_format($size, 2).array_shift($sxlist); } function str_ext($sz) { $dpos = strrpos($sz, '.'); return substr($sz, $dpos+1); } function is_image($sz) { return in_array(strtolower(str_ext($sz)), ['jpg', 'png', 'jpeg']); } function hesc($sz) { return @htmlentities($sz, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } function text2html($sz) { $base = nl2br(hesc($sz)); preg_replace('~(https?://.+\b)~i', '\1', $base); return $base; } /** * */ class CProject { private $dir; public $projname; public $shortdesc = '(no description)'; private $longdesc = ''; private $images = array(); private $downloads = array(); public $homeimage = 'no_image.png'; public function __construct($dirname, $projname) { $this->dir = BASEDIR.'data/'.$dirname.'/'; $this->projname = $projname; // Identify resources in folder $ls = scandir($this->dir); foreach($ls as $file) { if ($file[0] == '.') continue; if ($file == 'README.txt') { $this->longdesc = file_get_contents($this->dir.'README.txt'); $this->shortdesc = array_shift(explode("\n", $this->longdesc)); continue; } if (is_image($file)) { $this->images[] = $file; } else { $this->downloads[] = $file; } } } public function write() { // Generate image thumbnails foreach($this->images as $idx => $image) { $outfile = BASEDIR.'wwwroot/srv/'.$this->projname.'_'.$idx; copy($this->dir.$image, $outfile.'.'.str_ext($image)); mkthumbnail($outfile.'.'.str_ext($image), $outfile.'_thumb.jpg', PAGE_THUMB_W, PAGE_THUMB_H); } if (count($this->images)) { mkthumbnail( BASEDIR.'wwwroot/srv/'.$this->projname.'_0.'.str_ext($this->images[0]), BASEDIR.'wwwroot/srv/'.$this->projname.'_headimg.jpg', INDEX_THUMB_W, INDEX_THUMB_H ); $this->homeimage = 'srv/'.$this->projname.'_headimg.jpg'; } // Copy downloads to wwwroot foreach($this->downloads as $idx => $filename) { copy($this->dir.$filename, BASEDIR.'wwwroot/srv/'.$filename); } // Generate index page ob_start(); $this->index(); $idxfile = template($this->projname.' | '.SITE_TITLE, ob_get_clean()); file_put_contents(BASEDIR.'wwwroot/'.$this->projname.'.html', $idxfile); } public function index() { ?>

> projname)?>

ABOUT

longdesc)?>

downloads)) { ?> DOWNLOAD
images)) { ?>
images as $idx => $origname) { ?>
<?=hesc($title)?>
$projectname) { echo sprintf("[%2d/%2d] ".$projectname."...", ++$count, count($projects)); $pr = new CProject($dirname, $projectname); $pr->write(); $plist[] = $pr; echo " done\n"; } // Build index page ob_start(); ?>

This page contains several assorted projects, which no longer have any relation. They are listed in roughly chronological order (newest first). Unless specified otherwise, you may feel free to use and modify both the binaries and any source code, for any purpose, on the general condition you do not misrepresent who the author is (BSD license).

Some of these projects formerly appeared on Google Code here, but were moved following the discontinuation of the Google Code binary download system.

For bug reports, feature requests, or if you need any help, please click here to email me.

projname)?>, shortdesc)?> more...