config.php 777 0 0 1754 10333723557 6111 0 index.php 777 0 0 41650 10333675012 5762 0\n"; echo "\n"; echo "$blogname\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } else { header ("Content-type: application/rss+xml"); echo "\n"; echo "\n"; echo "\t\n"; echo "\t\t$blogname"; if ($category != "") { echo ": $category"; } echo "\n"; echo "\t\thttp://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]; if ($category != "") { echo "?category=$category"; } echo "\n"; echo "\t\t$blogdesc\n"; echo "\t\ten-EN\n"; echo "\t\tPolkaDot 1.1\n"; } // Sanitize things a bit. This is just to keep folks from trying to back up past the PolkaDot root level. $category = str_replace("/","",$category); $category = str_replace("..","",$category); $post = str_replace("/","",$post); $post = str_replace("..","",$post); if ($mode != "rss") { echo "
\n"; echo "\t

$blogname: $blogdesc

\n"; echo "\t

Current Category: "; // Print out the current category. if ($category == "") { echo "Main"; } else { echo $category; } echo "

\n"; echo "
\n"; echo "
\n"; echo "\t

Categories

\n"; echo "\t
    \n"; echo "\t\t
  • Main
  • \n"; } // First, get a list of all the directories // Get all files from the current directory, in alpha order $possibles = myscandir('.', '/.*/', 'name', 0); // Filter each for directories $directories = array(); // Whip through each, if it's a directory, and not on the skip list, add it to the list foreach ($possibles as $filename) { if (is_dir($filename) && $filename != "." && $filename != ".." && !in_array ( $filename, $skipDir)) { array_push($directories, $filename); if ($mode != "rss") { echo "\t\t
  • $filename
  • \n"; } } } if ($mode != "rss") { echo "\t
\n"; echo "
\n"; echo "
\n"; } // Check if this is a single post if ($post == "") { $files = array(); if ($category == "") { // No category means grab all the files, from each and every category // Get txt files from root directory, ordering it by modification date is a legacy thing $files = myscandir('.', '/\.txt$/i', 'mtime', 1); // For each sub-directory, get the txt files foreach ($directories as $dirname) { //echo "\n"; // Get txt files from the sub-directory $dirFiles = myscandir("./$dirname/", '/\.txt$/i', 'mtime', 1); // For each txt file found, add it to the list of files, along with its directory foreach ($dirFiles as $dirFilename) { array_push ($files, $dirname . "/" . $dirFilename); } } } else { // If there's a category, then just grab files from that category $dirFiles = myscandir("./$category/", '/\.txt$/i', 'mtime', 1); // Add each to the list of files foreach ($dirFiles as $dirFilename) { //echo "\n"; array_push ($files, $category . "/" . $dirFilename); } } // This is all kinda goofy, now that we have this big list of files, we're going to put them all in // a big structure, along with their system modification dates. Then we'll sort that structure based // on the modification dates, and display everything in date order, most recent first. // I'm sure there's a smoother way of doing all this. $fileStructure = array (); $nameData = array (); $filenameToCategory = array (); // Whip through each file foreach ($files as $filename) { // get mod date $thisDate = filemtime($filename); // split into directory and filename, if appropriate $nameData = explode('/', $filename); if ($nameData[1] == "") { $thisName = $nameData[0]; $thisDir = ""; } else { $thisName = $nameData[1]; $thisDir = $nameData[0]; } $thisCategory = $thisDir; if ( $thisCategory == "" ) { $thisCategory = "Main"; } //echo "\n"; // SRDEBUG create filename to categories hash table... if ( is_link($filename) ) { $realFileName = readlink($filename); // SRDEBUG scrub "../"s from target... $realFileName = str_replace("../", "", $realFileName); // SRDEBUG get array for $realFileName's category names... if ( is_array($filenameToCategory[$realFileName]) ) { //echo "
 SYMLINK: ADDING $filename has category \"$thisCategory\"
\n"; $tmp_array = $filenameToCategory[$realFileName]; } else { //echo "
 SYMLINK: CREATING $filename has category \"$thisCategory\"
\n"; $tmp_array = array(); } // SRDEBUG to add $realFileName -> $thisCategory to $realFileName's category names.. array_push($tmp_array, $thisCategory); $filenameToCategory[$realFileName] = $tmp_array; // SRDEBUG don't print dup in Main (no) category... if ($category == "") { //echo "
 IGNORING $filename: magic symlink duplicate posting
\n"; continue; } } // SRDEBUG need to add $filename -> $thisCategory to hash table if ( is_array($filenameToCategory[$filename]) ) { //echo "
 FILE: ADDING $filename has category \"$thisCategory\"
\n"; $tmp_array = $filenameToCategory[$filename]; } else { //echo "
 FILE: CREATING $filename has category \"$thisCategory\"
\n"; $tmp_array = array(); } // SRDEBUG to add $filename -> $thisCategory to $filename's category names.. array_push($tmp_array, $thisCategory); $filenameToCategory[$filename] = $tmp_array; // Add this one to the structure $fileStructure[] = array($thisName, $thisDir, $thisDate, $filename); } // Sort all the files in modification date order, most recent first usort($fileStructure, 'DateCompare'); // SRDEBUG get a count of posts so we know if we should print the footer.. foreach ($fileStructure as $filenameStructure) { $numPosts++; } // =================================================== // Time to spit out the files foreach ($fileStructure as $filenameStructure) { if ($start == 1) { //echo "\n"; // Get modification date $modDate = $filenameStructure[2]; //echo "\n"; // SRDEBUG Create permalink... $shortname = str_replace(".txt","",$filenameStructure[0]); if ($filenameStructure[1] == "") { $permalink = "?post=" . $shortname; } else { $permalink = "?category=" . $filenameStructure[1] . '&post=' . $shortname; } // SRDEBUG Get list of categories. $fullfilename = $filenameStructure[3]; $categories = $filenameToCategory[$fullfilename]; // SRDEBUG Construct list of category links... $cats_txt = ""; $i = 0; foreach ($categories as $cat) { $i++; if ( $cat == "Main" ) { $cats_txt = $cats_txt . "" . $cat . ""; } else { $cats_txt = $cats_txt . "" . $cat . ""; } if ( count($categories) != $i ) { $cats_txt = $cats_txt . ", "; } } if ( count($categories ) == 1 ) { $catInfo = "Category: $cats_txt"; } else { $catInfo = "Categories: $cats_txt"; } // Read in the file $lines = file_get_contents($fullfilename); // Convert HTML to HTML entities, if desired if ($convertHTML == 1) { $lines = str_replace("&","&",$lines); $lines = str_replace("<","<",$lines); $lines = str_replace(">",">",$lines); $lines = str_replace("\"",""",$lines); } // This next section does a bunch of string replacements in order to intelligently // make the title and add
and

tags where appropriate. // Replace first return with an

$lines = str_replace_once("\n","

",$lines); // Delete any blank line after title $lines = str_replace_once("

\n","

",$lines); // Replace each pair of returns with

$lines = str_replace("\n\n","

",$lines); // Replace each remaining single return with
$lines = str_replace("\n","
",$lines); // Prepend

,append

, and make the title a hyperlink if ($mode != "rss") { $lines = "

" . $lines . "

"; } else { $lines = "\t\t\t" . $lines . "</p>"; } // Add back in some returns, to make the source look pretty $lines = str_replace("</p>","</p>\n\n",$lines); $lines = str_replace("<br />","<br />\n",$lines); if ($mode != "rss") { // Add in the posted date and category // SRDEBUG added postedFormat config var... //$lines = str_replace("</h3>","</h3>\n<p class=\"byline\">Posted: " . date ($postDateFormat, $modDate) . "</p>\n<p class=\"byline\">Category: $catLink</p>\n",$lines); $lines = str_replace("</h3>","</h3>\n<p class=\"byline\">Posted: " . date ($postDateFormat, $modDate) . "</p>\n<p class=\"byline\">$catInfo</p>\n",$lines); } else { $lines = str_replace("</a></h3>","\n\t\t\thttp://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . htmlentities($permalink) . "\n\t\t\t\n"; } else { echo "\t\t\n"; echo "$lines\n"; echo "\t\t\t]]>\n"; echo "\t\t\t" . date("Y-m-d", $modDate) . "\n"; echo "\t\t\n"; } $maxPosts--; // Jump out of the loop if we've printed enough posts if ($maxPosts == 0) { break; } } else { $start--; } } if ($mode != "rss") { // SRDEBUG don't print footer when there's no "Next" posts etc etc... //echo "
 numPosts=$numPosts
\n"; $displayNext = $savedStart+$savedMax; //echo "
 displayNext=$displayNext (savedStart=$savedStart + savedMax=$savedMax)
\n"; $numLeft = $numPosts - $displayNext + 1; //echo "
 numLeft=$numLeft (numLeft=$numPosts - displayNext=$displayNext + 1)
\n"; if ( ($displayNext <= $numPosts) || ($savedStart != 1) ) { // need Next or Prev links... print start of footer... echo "

"; if ( $savedStart != 1 ) { // SRDEBUG... print Prev link... echo "Previous $savedMax Posts"; } if ( ($displayNext <= $numPosts) && ($savedStart != 1) ) { // Prev *and* Next... print separator... echo " :: "; } if ( $displayNext <= $numPosts ) { // print Next link... echo "Last Post"; } elseif ( $numLeft < $savedMax ) { echo "\">Last $numLeft Posts"; } else { echo "\">Next $savedMax Posts"; } } // print end of footer... echo "

\n"; echo "
\n"; } else { //echo "
 no next 
\n"; } } // =================================================== } else { // We're just dealing with a single post, a permalink, if you will, so grab and dump it // Make the filename //$filename = $category . '/' . $post . ".txt"; if ($category != "") { $fullfilename = $category . '/' . $post . ".txt";; $catLink = "" . $category . ""; $permalink = "?category=" . $category . '&post=' . $post; } else { $fullfilename = $post . ".txt";; $catLink = "Main"; $permalink = "?post=" . $post; } // Get modification date $modDate = filemtime($fullfilename); //echo "\n"; // Read in contents of file $lines = file_get_contents($fullfilename); // Fix HTML, if desired if ($convertHTML == 1) { $lines = str_replace("&","&",$lines); $lines = str_replace("<","<",$lines); $lines = str_replace(">",">",$lines); $lines = str_replace("\"",""",$lines); } // Add tags to make it look pretty // Replace first return with an

$lines = str_replace_once("\n","

",$lines); // Delete a blank line after title $lines = str_replace_once("

\n","

",$lines); // Replace each pair of returns with

$lines = str_replace("\n\n","

",$lines); // Replace each single return with
$lines = str_replace("\n","
",$lines); // Prepend

and append

if ($mode != "rss") { $lines = "

" . $lines . "

"; } else { $lines = "\t\t\t" . $lines . "</p>"; } // Add back in some returns, to make the source look pretty $lines = str_replace("</p>","</p>\n\n",$lines); $lines = str_replace("<br />","<br />\n",$lines); if ($mode != "rss") { // Add in the posted date and category $lines = str_replace("</h3>","</h3>\n<p class=\"byline\">Posted: " . date ("F d Y g:i:sa", $modDate) . "</p>\n<p class=\"byline\">Category: $catLink</p>\n",$lines); } else { $lines = str_replace("</a></h3>","\n\t\t\thttp://" . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] . htmlentities($permalink) . "\n\t\t\t\n"; } else { echo "\t\t\n"; echo "$lines\n"; echo "\t\t\t]]>\n"; echo "\t\t\t" . date("Y-m-d", $modDate) . "\n"; echo "\t\t\n"; } } if ($mode != "rss") { echo "

\"Powered

\n"; echo "

\n"; echo "
\n"; echo "\t

$staticLinksTitle

\n"; echo "\t
    \n"; // make the static links for the right-hand sidebar foreach ($staticLinks as $linkStructure) { echo "\t\t
  • " . $linkStructure[0] . "
  • \n"; } echo "\t
\n"; if ( $displayRSS ) { echo "

RSS 2.0 Feed

\n"; } echo "
\n"; echo "\n"; echo "\n"; } else { echo "\t
\n"; echo "
\n"; } // Common functions // These were all shamelessly stolen from the php.net comments sections // Replaces only the first occurance function str_replace_once($needle, $replace, $haystack) { // Looks for the first occurence of $needle in $haystack // and replaces it with $replace. $pos = strpos($haystack, $needle); if ($pos === false) { // Nothing found return $haystack; } return substr_replace($haystack, $replace, $pos, strlen($needle)); } // Let's you specify a regular expression for matching files, and let's you order them in different ways function myscandir($dir, $exp, $how='name', $desc=0) { $r = array(); $dh = @opendir($dir); if ($dh) { while (($fname = readdir($dh)) !== false) { if (preg_match($exp, $fname)) { $stat = stat("$dir/$fname"); $r[$fname] = ($how == 'name')? $fname: $stat[$how]; } } closedir($dh); if ($desc) { arsort($r); } else { asort($r); } } return(array_keys($r)); } // Sets up a compare function to sort the big file structure. Basically, it's just comparing the date elements. function DateCompare($a, $b) { return ($a[2] < $b[2]) ? 1 : -1; } ?> poweredby.png 777 0 0 5374 10333675020 6632 0PNG  IHDR~(5tEXtCreation Time [mKtIME LU pHYs  ~ zIDATxZ |MWg7Id!BZPKI:bF:"LnJu,eV)B "F%$d{ɛE}R+9{?sI ^@ӿ8G!L+/.䣼ީV#-EG_]Xeuβ2,{ٙ0s,r?ZJ!oIs|D@@A kl!cc+rC 7omGed>Oi\8ܹ]|ᰰTRpm=)%h^™'Dfg+j98,']' к=:vç(_a%]݊?'pp7~fdnk' EvLK/Xob_ DZ*r@h Gg$'h w ll%]NaWD`͗<3&& h䇤4jƺqo˗amˁTRQ{G4.FJWwJ8qc&* ^y,Ѯ3_(u#aRDQ=3|<в)ԃ3}ڮlѿRncb&v$p%e&$bs?-^ qmtn[g{a`.b҇x-և8Y0G!5;]ڡaIPǍoJ]+~|`o4zA)cFcwèpuc5fцޒyع1{ 8wh\h]L[Um[Z`L->G1fv6i Y›YΎ-3ŋqs?M%fyTz328X'w~#}lڒwRߌ6:!a2Y;LGC2H782ɺ;3h?ᯓ02{aJgy5 dNd%oֈXDPt0RM>w%缾GT%)X Y 3o)6ΡNE9!i9x?lmdw h&0WLSa&t@8{|sBl|3"]?2ɒbWfIj&jgbn)|EBV(b?Z`gGQE2GvEx AoDC+@^+*+bS z_0c ߀Rt뀬\|uo.»n^=#ʜɊ)rǵD-ikt幅\G#USIڵYlx߻f˜ ab12%XwaewWORXj# K7  @-Z?n>ŔqP@8'TZ ÒKL$D:Yv-AqUIq4+.Whx}={8䢬ɞbSnʧ pܸWÄH)#2]>L)I/& #j<Sra-7~G8O_w7~7z=>H)Ȗ bʵU61X'/b} }j}cd 3CNH(>XF*CNeܿ 9j2C`(bq㈉O'Y#!5BLy 걡 Zf'3_m^MvrѧtXWI\"NʇBӭ8{Y[;눣frfD+ǻҪ]7G=t )>h4 3ja4B}/SLL74,+pG S`tՅX ,3 Bㆢy\c9sů9 [~BRVq%'&in| ;sGitxm4q=pU1' 27s݄Z8{%Vu7&ޒ _!!φ*'{?qǷBuq*~B<S5, ;?lhO6e 1 gOKu $UA}[kl3}9:dzE+>O${̷|3aZЂ K[xj}mzJ|body #centercontent { margin-left: 201px; margin-right: 201px; } #rightcontent { position: absolute; right: 0px; top: 80px; width: 200px; background: LemonChiffon; border-top: 0px solid #000; border-right: 0px solid #000; border-left: 0px solid #000; border-bottom: 0px solid #000; } #banner { background: Black; height: 80px; border-top: 0px solid #000; border-right: 0px solid #000; border-left: 0px solid #000; border-bottom: 0px solid #000; voice-family: "\"}\""; voice-family: inherit; height: 79px; } html>body #banner { height: 79px; } p,h1,h2,h3,h4,pre { margin: 0px 10px 10px 10px; } h1,h2,h3 { font-size: 14px; padding-top: 10px; } h4 { font-size: 12px; padding-top: 10px; } #banner h1 { color: Yellow; font-size: 16px; padding: 10px 10px 0px 10px; margin: 0px; } #banner h2 { color: Yellow; font-size: 12px; padding: 10px 10px 0px 10px; margin: 0px; } #banner a { color: Yellow; text-decoration: none; } #rightcontent p { font-size:10px; margin-left: 0.2in; } #rightcontent form { font-size:10px; margin-left: 0.2in; } #rightcontent ul { font-size: 10px; } #rightcontent a { color: Black; text-decoration: none; } #leftcontent p { font-size: 10px; } #leftcontent ul { font-size: 10px; } #leftcontent a { color: Black; text-decoration: none; } #centercontent h3 { font-size: 14px; } #centercontent p { margin-left: 0.2in; margin-right: 0.2in; font-size: 12px; } #centercontent p.byline { margin-left: 0.2in; margin-right: 0.2in; font-size: 10px; } #centercontent p.alert { margin-left: 0.2in; margin-right: 0.2in; font-size: 12px; font-weight: bold; } #centercontent p.footer { text-align: center; } #centercontent ul { font-size: 12px; } #centercontent ol { font-size: 12px; } #centercontent a { color: Black; text-decoration: none; }