Flap.TV http://flap.tv/photos Photos taken by Chad Lieberman en-us Copyright 2005-2009 Chad Lieberman '. date("D, j M Y H:i:s T") .' '; $path_to_here = "/home/httpd/vhosts/flap.tv/httpdocs/photos/"; $http_to_here = "http://flap.tv/photos/"; $thumbnail_path = "thumbnails/"; $images_path = "images/"; $pages_path = "pages/"; $feedLocation = $path_to_here . "feed.xml"; function get_indexes($year,$month,$day){ global $path_to_here,$http_to_here,$i,$rssItem; $directory_year = $path_to_here . $year; if(!file_exists($directory_year) || !is_dir($directory_year)) { // ... we return false and exit the function return FALSE; // ... else if the path is readable } elseif(is_readable($directory_year)) { // this year is readable - set year and loop thru directory $ThisYear = $year; // we open the directory $directory_year_list = opendir($directory_year); // and scan through the items inside while (FALSE !== ($month = readdir($directory_year_list))) { // each of these is a month - create new directory for month // $ThisMonth = $month; $directory_month = $directory_year . "/" . $month; if($ThisMonth != '.' && $ThisMonth != '..') { //print "opening $directory_month
"; $directory_month_list = opendir($directory_month); while (FALSE !== ($day = readdir($directory_month_list))) { $ThisDay = $day; //echo "day: $ThisDay
"; // each of these is a day // if($ThisDay != '.' && $ThisDay != '..') { $directory_day = $directory_month . "/" . $day; $directory_day_list = opendir($directory_day); // open index page // $thisIndex = $directory_day . "/index.htm"; $thisThumbs = $directory_day . "/thumbnails"; if (file_exists($thisIndex)) { if ($thumbnailDir = opendir($thisThumbs)) { while (false !== ($thumb = readdir($thumbnailDir))) { if ($thumb != "." && $thumb != "..") { $thisThumb = $thumb; break; } } closedir($thumbnailDir); } $fp = fopen($thisIndex, "r"); $contents = fread($fp, filesize($thisIndex)); fclose($fp); eregi("(.+)", $contents, $regs); if (!$regs[1]) { $title = "(untitled)"; } else { $title = $regs[1]; } $link = $http_to_here . $ThisYear . "/" . $ThisMonth . "/" . $ThisDay . "/"; $url = $link . "thumbnails/" . $thisThumb; $rssItem[$i]["description"] = $title; $rssItem[$i]["title"] = trim(str_replace("Chad Lieberman :: Photography ::", "", $title)); $rssItem[$i]["title"] = trim(str_replace("Chad Lieberman :: Photos ::", "", $rssItem[$i]["title"])); $rssItem[$i]["link"] = $link; $rssItem[$i]["date"] = date("D, j M Y H:i:s T",mktime(0,0,0,$ThisMonth,$ThisDay,$ThisYear)); $rssItem[$i]["url"] = $url; $rssItem[$i]["category"] = "Photography"; $i++; } } } } } } } get_indexes('2004',$month,$day); get_indexes('2005',$month,$day); get_indexes('2006',$month,$day); get_indexes('2007',$month,$day); get_indexes('2008',$month,$day); $result = array_reverse($rssItem, true); foreach ($result as $key=>$val){ $xml .= ' '. $val['title'].' '.$val['description'].'<BR /> <A HREF = "'. $val['link'].'"><img src="'.$val['url'].'" border="0" alt="'.$val['description'].'"></A> '. $val['link'].' '. $val['link'].' '. $val['date'].' '. $val['category'].' '.$val['url'].' '; } $xml .='
'; function saveFeed($filename="", $content, $displayContents=true) { $feedFile = fopen($filename, "w+"); if ($feedFile) { fputs($feedFile,$content); fclose($feedFile); } else { echo "
Error creating feed file, please check write permissions.
"; } } saveFeed($feedLocation,$xml); ?>