AROS stuff
<?php
    
function view_image($image)
    {
        
$info getimagesize($image); 
        
$types = array('Unknown''GIF''JPG''PNG''SWF''PSD''BMP',
                       
'TIFF (Little Endian)''TIFF (Big Endian)''JPC',
                       
'JP2''JPX''JB2''SWC''IFF-ILBM''WBMP''XBM');
?>
        <p>
            <strong>Width</strong>: <?= $info[0]; ?><br />
            <strong>Height</strong>: <?= $info[1]; ?><br />
            <strong>Type</strong>: <?= $types[$info[2]]; ?><br />
            <strong>MIME type</strong>: <?= $info['mime']; ?><br />
            <strong>Channels</strong>: <?= $info['channels']; /*undef for PNG*/ ?><br /> 
            <strong>Bits/Channel</strong>: <?= $info['bits']; ?>
        </p>
        <p>
            <img 
                style="border: 1px solid black;"
                <?= $info[3]; ?>
                src="<?=$image;?>
                alt="<?=$image?>
            />
        </p>
<?    
    
}

    function 
perms2str($file)
    {
        
$st lstat($file);
        
$prms $st[2];
        
        
// Link ('l'), directory ('d'), or file ('-').
        
$out = ( ($prms 020000) ? 'l'                                 
                                  
: (($prms 040000) ? 'd' '-') );

        for(
$i 0400$j 04000$i >= 04$i /= 010$j /= 02)
            {
            
// Is file readable (by user ($i == 0400), group ($i == 040), all ($i == 04))?
            
$out .= (($prms $i) ? 'r' '-');
            
// Writeable?
            
$out .= (($prms & ($i 02)) ? 'w' '-');

            if(
$prms $j// Is the file setuid, setgid or sticky?
                
$out .= (($j == 01000) ? 't' 's');  // 't' is for sticky.
            
else           // Executable?
                
$out .= (($prms & ($i 04)) ? 'x' '-');
            }
        return 
$out;
    }

    function 
size_conv($size)
    {
        
/* Nope, no terabytes (or exa-, or petabytes) shown.
           Actually, considering sourceforge's quotas, we'll never see any
           gigabytes either... */
        
if($size >= 1073741824)   return sprintf("%.1fG"$size/1073741824);
        else if(
$size >= 1048576) return sprintf("%.1fM"$size/1048576);
        else if(
$size >= 1024)    return sprintf("%.1fk"$size/1024);
        else                      return 
"$size";
    }

    function 
get_file_info($file)
    {
        if(
file_exists($file))
            {
            
$out .= "<td><code>" perms2str($file) . "</code></td>\n";
            
$out .= "<td class=\"right\">" size_conv(filesize($file)) . "</td>\n";
            
$out .= "<td>" date("Y/m/d H:i:s"filemtime($file)) . "</td>\n";
            }
        return 
"$out";
    }

    function 
list_dir($dir)
    {
        
$d dir($dir);
        
$dirs $files "";
        echo 
"<table summary=\"Listing of directory $dir\">\n";
        echo 
'<tr style="font-weight: bold;">'.
                 
'<td>Filename</td>'.
            
'<td>Permissions</td>'.
                 
'<td>Size</td>'.
                 
'<td>Last modified</td>'.
             
'</tr>';
        global 
$username;

        while(
$buff $d->read())
            {
            
// yes, a lot of code to print one little filename...
            
if(isset($username) ||
               ((
strncmp($buff'.'1) || !strcmp($buff'.htaccess')) && strncmp($buff'etc'3)))
                {
                if(
is_dir("$dir/$buff"))
                    {
                    
$dirs .= "<tr><td>\n" .
                        
"<a href=\"?content=sources&amp;filename=$dir/$buff\" class=\"sourceDir\">$buff/</a>";
                    
$dirs .= "\n</td>" get_file_info("$dir/$buff") . "</tr>\n";
                    }
                else
                    {
                    
$files .= "<tr><td>\n";
                    if(
preg_match("'\.php\$|\.inc\$|\.html\$|\.css\$|\.tmpl\$|\.rss\$|\.js\$|\.pl\$|^\.htaccess\$'i",
                                  
$buff) || !strstr($buff"."))
                        {
                        
$files .=
                           
"<a href=\"?content=sources&amp;filename=$dir/$buff\" "
                            
"class=\"sourceFile\">$buff</a><br />";
                        }
                    else if(
getimagesize("$dir/$buff"))
                        
$files .=
                           
"<a href=\"?content=sources&amp;filename=$dir/$buff\" ".
                             
"class=\"sourceImage\">$buff</a><br />";
                    else if(
preg_match("'\.gz$|\.tar$|\.zip$|\.bz2$|\.lha$'i"$buff))
                        
$files .= "<a href=\"/$dir/$buff\" class=\"sourceArch\">$buff</a><br />";
                    else
                        
$files .= "<a href=\"/$dir/$buff\">$buff</a><br />";
                    
$files .= "\n</td>"get_file_info("$dir/$buff") . "</tr>\n";
                    }
                }
            }
        echo 
"$dirs$files\n</table>";
    }


    if(isset(
$_GET["filename"]))
        
$filename $_GET["filename"];
    else
        
$filename ".";
    
    function 
path2links($p)
    {
        
$pp pathinfo($p);
        
$path $pp["dirname"];
        
$file $pp["basename"];
        
        
// Recurse if not at webroot.
        
if($path !== $filepath2links($path);
        
printf("%s<a href=\"?content=sources&amp;filename=%s\" class=\"noul source%s\">%s</a>",
               (
$file == ".") ? "" "/"$pis_dir($p) ? "Dir" 
                                                         
: (getimagesize($p) ? "Image" 
                                                                             
"File"),
                 (
$path == $file) ? "aros-stuff.tk" $file);        
    }
?>
<div class="commonMain">
<?
    
echo '<div class="commonCaption boldlinks">';
    
path2links($filename);
    echo 
'</div>';
    
    echo 
'<div class="commonContent">';
    if(isset(
$username) || (!strstr($filename'..') && strncmp($filename'/'1)
        && !
strstr($filename':') &&
        !
strstr($filename'etc/') && !strstr($filename'/etc') && !strstr($filename'/.')))
        {
        if(
is_dir($filename)) 
            
list_dir($filename);
        else if(
file_exists($filename)) 
            {
            if(
getimagesize($filename))
                
view_image($filename);
            else
                {
                
ini_set('highlight.keyword''#800080');
                
ini_set('highlight.comment''#00a000');
                
show_source($filename);
                echo 
'<div class="right"><a href="/?content=gpl">'
                echo 
'Copyright &copy; 2003, 2004 Kalle R&auml;isanen</a></div>';
                }
            }
        else echo 
"Invalid filename &quot;$filename&quot;!";
        }
    else echo 
"Illegal filename &quot;$filename&quot;!";
    echo 
'</div>';
?>
</div>
 
Latest News
Migration
kal, 2005/11/26 14:09:10.

"Code changes!" they cried.
kal, 2004/12/08 11:38:01.

Ages
kal, 2004/09/25 02:01:04.

Linkish
kal, 2004/07/10 07:40:57.

No updates
kal, 2004/05/16 06:57:33.

Latest Software
read 0.3.6
kal, 2004/04/30 07:14:24.

nroff 1.10
kal, 2004/04/22 08:29:10.

Nenscript 1.13.3
kal, 2004/04/22 08:23:53.

necho 0.2.3
kal, 2004/04/19 10:58:47.

dgrep 0.1.4
kal, 2004/04/19 10:49:42.

Select Theme
  

Copyright © 2003, 2004 Kalle Räisänen.
Sources: index.php, global.inc, init.inc, theme.inc, navigation.php, sources.php, rightbar.php, xml.inc, io.inc, theme.php, footer.php