<?
// function to remove the hyphen or underscore from filename.
function removeHyphen($filename) {
    
$target $filename;
    
$patterns[0] = '/-/';
    
$patterns[1] = '/_/';
    
$replacements[0] = ' ';
    
$replacements[1] = ' ';
    
$filename preg_replace($patterns$replacements$target);
    return 
$filename;
}
// function to capatalize the first character of each word.  Must be called after
// the removal of the hyphen or underscore
function capFirstWord($word) {
    
$cap $word;
    
$cap explode(' '$cap);
        foreach(
$cap as $key => $value) {
            
$cap[$key] = ucfirst($cap[$key]); 
        }
    
$word implode(' '$cap);
    return 
$word;
}
// Formats the file.  This is the main function that calls all functions explained above.
function formatFile($name) {
    
$name removeHyphen($name);
    
$name capFirstWord($name);
    return 
$name;
}

function 
scriptList ($dir) {
$mydir dir('./'.$dir);
echo 
"<div>";
    while((
$file $mydir->read()) !== false) {
        
$ffile "./$dir/$file";
        if (
$file != "." && $file != ".." && !fnmatch("*.php"$ffile) && !fnmatch("*.desc"$ffile)) {
        
$size round(filesize($ffile) / 10242);
        
$mod filemtime($ffile);
            echo 
"\n\n<p><a href='$ffile'>".formatFile($file)."</a> ";
            echo
"<font size='2'>File Size: " .$size"KB - Last Modified: " .date('d/m/Y'$mod). " - To Update Type:</font> ";
            echo 
"<input type='text' id='".$dir.$file."' onclick='copyToClipboard(\"".$dir.$file."\");' value='/sbnc tcl catch {exec wget --output-document=scripts/".$file." http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).ltrim($ffile,".")."} o; foreach l [split \$o \\n\"] { putlog \$l }; rehash;' />";
            
$descfile $ffile.'.desc';
            if (
file_exists($descfile)) {
                
$fh fopen($descfile'r');
                
$theData fgets($fh);
                
fclose($fh);
                echo 
"\n<br /><font color='#736F6E'>".$theData." <a href='".$descfile."'>Read more.</a></font>";
            }
            echo 
"</p>";

         }
    }
echo 
"\n</div>\n";
$mydir->close();
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>sBNC Scripts</title>
        <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />    
        <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
        <script type="text/javascript">
            $(function(){
                // Tabs
                $('#tabs').tabs();
            });
        </script>
<script type="text/javascript">
function copyToClipboard(field)
{
    var content = eval(document.getElementById(field))
    content.focus()
    content.select()
    range = content.createTextRange()
    range.execCommand("Copy")
}
</script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-174970-4']);
  _gaq.push(['_setDomainName', '.khobbits.co.uk']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>

</head>
<body>
<h1>sBNC Scripts</h1>

<p>The sBNC scripts here are split into a few sections, firstly scripts which work on any version of sBNC (or at least as far as I know), and then version specific scripts.  These will probably not work on another version, or have been replaced.</p>


<div id="tabs">
<ul>
<li><a href="#other">Info</a></li>
<li><a href="#sbnc">All sBNC</a></li>
<li><a href="#sbnc3">sBNC 1.3</a></li>
<li><a href="#sbnc2">sBNC 1.2</a></li>
<li><a href="#sbnc1">sBNC 1.1</a></li>
<li><a href="#sbnct">sBNC Templates</a></li>

</ul>

<div id="sbnc">
<h3>Scripts for all versions</h3>
<p>The scripts in this section should work on all versions of sBNC</p>
<? scriptList ("sbnc"); ?>
</div>
<div id="sbnc3">
<h3>Scripts for sbnc 1.3+</h3>
<p>The scripts in this section should work on sBNC 1.3+</p>
<? scriptList ("sbnc1.3"); ?>
</div>
<div id="sbnc2">
<h3>Scripts for sbnc 1.2</h3>
<p>The scripts in this section should work on sBNC 1.2.<br />I don't recommend using these with other versions of sBNC.</p>
<? scriptList ("sbnc1.2"); ?>
</div>

<div id="sbnc1">
<h3>Scripts for sbnc 1.1</h3>
<p>The scripts in this section should work on sBNC 1.1.<br />I don't recommend using these with other versions of sBNC.</p>
<? scriptList ("sbnc1.1"); ?>
</div>

<div id="sbnct">
<h3>sBNC TCL Templates and Snippits.</h3>
<p>The scripts in this section will generally need some modifying before loading on sBNC.<br />
Most of these scripts require you to set the user they will load on by changing the 'setctx' line.</p>
<p>Some of these scripts are just proof of concept or snippits to save people time.</p>
<? scriptList ("template"); ?>
</div>

<div id="other">
<h3>Info</h3>
<p>The scripts you find here are offered free to anyone who wants to use them, with the understanding that your using them at your own risk,
 and that I can't promise you any support for problems you might encounter.</p>
<p>The reason these scripts are available is simply that I thought others might want to use and improve upon them.</p>
<p>Not all of the scripts on this site have been created or in some cases edited by me.  While I have customised the functionality of most scripts on here.
Some scripts are simply here because I found them useful and wanted to share them.</p>
<p>Most of the scripts here were written to fill some personal need.  The changes I make are usually to add a function I decided I couldn't do without.</p>

<h3>Installing</h3>
<p>To install these scripts you will need to place them in the scripts folder, and then edit the sbnc.tcl script source list, to tell the bnc to load the script.
<br />Once a script has been added to your sbnc.tcl, you can download and update the script simply by running the command in the text box next to the script.</p>

<h3>Contact</h3>
<p>If you do need to get in touch with me for whatever reason you can try #kh on irc.swiftirc.net. For other sbnc issues I would checking out the support <a href="http://www.shroudbnc.info/Support.aspx">here.</a></p>

<h3>Unedited Scripts</h3>
<p><a href="./unedited/">I have hosted a copy</a> of the original unedited versions of the distributed scripts, incase you want to restore the functionality after overwriting the script.</p>

<h3>Lain</h3>
<p>Like most people, I write scripts to surve a specific purpose, I host a general IRC Bot called Lain on a few networks, the scripts are usually not written to distribution standard, but on request I occasionally make specific script source public, some of which are available <a href="https://github.com/khobbits/Lain">on github</a> for people who don't mind digging through dirty TCL.</p>

</div>
</div>

 <p>
    <a href="http://validator.w3.org/check?uri=referer"><img
        src="valid-xhtml10-blue"
        alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
  </p>
  
  
 </body>
</html>