Download
IMPORTANT: It is a requirement to have at least PHP 5 installed before using Sage .21 . Other PHP versions will be supported later.
Sage is getting an update. Version 1.0 will be out soon, with better code construction and the XML-based backend! Estimated Deployment: Jan 30 2008
Sage is 100% free under the PHP License 3.01 and is licensed under a Creative Commons Attribution-Share Alike 3.0 License, as long as the KP Labs, Inc, copyright is kept within the script, or recognition of the author is stated.
You may want to check the Change Log to make sure your system can process the commands
Download Sage .21 for your site (Works for All operating systems and browsers)
Either download the source file (2484 bytes) or copy the code below:
Before you get started, make sure you read the ReadMe file! This has all of the instructions you need to get started! In case you miss this, either read this file or check out the Setup section.
Source:
<?php
####################################
#
# Sage
# Automated Site Map Generator
# Last Updated: 20071206
# Copyright 2007 KP Labs, Inc
# http://kplabs.com/sage
# All Rights Reserved
#
####################################
?>
<?php require("http://kplabs.com/sage/header.php");?>
<?php
$dir = '.';
$files = scandir($dir);
foreach( $files as $pos => $file ) {
if( is_dir( $file ) ) {
if (!strstr($file, ".")){
if (!file_exists($file."/nosage")){
$dirs[] = $file ;
}
}
}
}
function replace($var){
#do a replacement for common terms and acronyms
switch ($var){
case "dl": $var="downloads"; break;
case "port": $var="portfolio"; break;
case "faq": $var="FAQ's"; break;
#default: break;
}
return ucwords($var);
}
echo "\n\t<ul>";
foreach ($dirs as $link){
#set the current directory to a variable
$thisdir=substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'],"/"));
echo "\n\t\t<li><a href='$thisdir/$link'>";
echo replace($link);
echo "</a>";
$subdir="";
$subfiles=scandir($link);
foreach ($subfiles as $sdir){
#don't show any image files, index files, menu files, css files, and any custom extentions
# and also doesn't display any folders that have a "nosage" folder
if (($sdir!= ".")
&& ($sdir!="..")
&& ($sdir[0]!=".")
&& (!stristr($sdir, ".bak"))
&& (!stristr($sdir, ".png"))
&& (!stristr($sdir, ".jpg"))
&& (!stristr($sdir, ".gif"))
&& (!stristr($sdir, ".bmp"))
&& (!stristr($sdir, ".ico"))
&& (!stristr($sdir, "~"))
&& (!stristr($sdir, "index."))
&& (!stristr($sdir, ".css"))
&& (!stristr($sdir, "menu"))
&& (!stristr($sdir, ".sd"))
&& (!stristr($sdir, "_"))
&& (!file_exists($link."/".$sdir."/nosage"))
){
$subdir[]=$sdir;
}
}
if ($subdir){
echo "\n\t\t\t<ul>";
foreach ($subdir as $sdir){
echo "\n\t\t\t<li><a href='$thisdir/$link/$sdir'>";
$thisfile=replace($sdir);
if (strstr($thisfile, ".html"))
$thisfile=substr($thisfile, 0, strlen($thisfile)-5);
else if (strstr($thisfile, ".php"))
$thisfile=substr($thisfile, 0, strlen($thisfile)-4);
echo $thisfile;
echo "</a></li>";
}
echo "\n\t\t\t</ul>";
}
echo "\n\t\t</li>";
}
echo "</ul>";
?>
<?php require("http://kplabs.com/sage/footer.php");?>