< < < Click here to go back to the main site

List of available files:

templates/
    images/
    style/
        > gallery.css
    > contact.txt
    > footer.txt
    > header.txt
basecode/
    > Gallery.php
    > gallerybuilder.php
    > GalleryItem.php
    > GalleryNavigationData.php
    > GallerySection.php
    > includer.php
    > Photograph.php
    > Video.php
pictures/
> gpl.txt
> index.php
> opensource.php

Showing source of: ./opensource.php


<?php

    
/***************************************************************************
     * jpbGallery 1.0.0 Copyright (c) 2007 Jean-Philippe Barbeau
     * Contact: jp $at> jpbarbeau $dot> com
     ***************************************************************************
     * This file is part of the jpbGallery project.
     *
     * jpbGallery is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 3 of the License, or
     * (at your option) any later version.
     * 
     * jpbGallery is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     * 
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    -***************************************************************************/

    
define(DEFAULT_FILE'./index.php');
    
define(ACCEPTED_EXTS'css|php|txt');
    
define(MY_PAGE'./opensource.php');

    
header('Content-Type: text/html; charset=ISO-8859-1');

    
    
$file get_file();
    
?>

<html>
<head>
<title>Source of <?php echo htmlspecialchars($file); ?></title>
</head>

<body>

<?php

    
/* Print a link back to the main site */
    
print_link_back();

    
/* Output the main directory listing */
    
echo '<p style="font-weight: bold;">List of available files:</p>';
    echo 
'<p style="background-color: rgb(192, 192, 192); padding: 5px;">';
    
list_dir('./');
    echo 
'</p>';
    
    
/* Show the source for the selected file */
    
echo '<p style="font-weight: bold;">Showing source of: ' htmlspecialchars($file) . '</p><hr />';
    
highlight_file($file);
    
    
/* Print that link again */
    
print_link_back();
    
    
    function 
get_file()
    {
        
/* Gets the file to show the source code for */
        
        
if (is_readable($t './' $_GET['file']) && is_file($t))
        {
            if (
preg_match("#\\.\\./#"$_GET['file']))
            {
                return 
DEFAULT_FILE;
            }
            
            else
            {
                return 
'./' $_GET['file'];
            }
        }
        
        else
        {
            return 
DEFAULT_FILE;
        }
    }
    
    
    function 
list_dir($path$prefix '')
    {
        
/* Recursively print a directory listing to the output stream */
        
        
$dir opendir($path);
        
        while ((
$el readdir($dir)) !== false)
        {
            
/* Process a directory entry */
            
if (is_dir($path $el))
            {
                
/* If this is a real directory, recursively process it */
                
                
if ($el != '.' && $el != '..')
                {
                    echo 
$prefix '<span style="font-style: italic;">' htmlspecialchars($el '/') . '</span><br />';
                    
list_dir($path $el '/'$prefix '&nbsp;&nbsp;&nbsp;&nbsp;');
                }
            }
            
            else
            {
                
/* We are handling a file. Create a link to it. */
                /* Check if the file has one of the approved extensions. */
                
                
if (preg_match('#\\.(' ACCEPTED_EXTS ')$#i'$el))
                {
                    
/* Print it */
                    
$requestingFile substr($path $el2);
                    echo 
$prefix '&gt; <a title="Source of ' htmlspecialchars($el) . '" href="' MY_PAGE;
                    echo 
'?file=' htmlspecialchars(urlencode($requestingFile)) . '">' $el '</a><br />';
                }
            }
        }
        
        
closedir($dir);
    }
    
    
    function 
print_link_back()
    {
        echo 
'<p style="background-color: rgb(192, 192, 192); padding: 5px;">';
        echo 
'<a title="Back to the main site" href="./">&lt; &lt; &lt; Click here to go back to the main site</a>';
        echo 
'</p>';
    }

?>

</body>
</html>

< < < Click here to go back to the main site