* @version 1.2.1 (January 06, 2007)
*
* @copyright Copyright (C) 2002-2007 Justin Hagstrom
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
*
* @link http://autoindex.sourceforge.net
*/
/*
AutoIndex PHP Script 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 2 of the License, or
(at your option) any later version.
AutoIndex PHP Script 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, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* OPTIONAL SETTINGS:
*/
//filenames and paths for configuration related files
define('CONFIG_STORED', 'AutoIndex.conf.php');
define('CONFIG_GENERATOR', 'config.php');
//paths for files that will be included
define('PATH_TO_CLASSES', './classes/');
define('PATH_TO_LANGUAGES', './languages/');
define('LANGUAGE_FILE_EXT', '.txt');
//filenames of template files
define('GLOBAL_HEADER', 'global_header.tpl');
define('GLOBAL_FOOTER', 'global_footer.tpl');
define('TABLE_HEADER', 'table_header.tpl');
define('TABLE_FOOTER', 'table_footer.tpl');
define('EACH_FILE', 'each_file.tpl');
/**
* When ENABLE_CACHE is true, the indexes of directories will be stored in
* files in the folder CACHE_STORAGE_DIR. You will notice a speed improvement
* when viewing folders that contain a few thousand files. However, the contents
* of the indexed folders will not be updated until you delete the cache file.
*/
define('ENABLE_CACHE', false);
/**
* This is the folder cache data will be stored in. PHP needs write permission
* in this directory. You can use an absolute path or a relative path, just
* make sure there is a slash at the end.
*/
define('CACHE_STORAGE_DIR', './cache/');
/**
* Format to display dates in.
* @see date()
*/
define('DATE_FORMAT', 'Y-M-d');
/**
* Sets debug mode. Off (false) by default.
*/
define('DEBUG', false);
/* END OPTIONAL SETTINGS */
/** The time this script began to execute. */
define('START_TIME', microtime(true));
/** Level for disabled/banned accounts. */
define('BANNED', -1);
/** Level for Guest users (users who are not logged in). */
define('GUEST', 0);
/** Level for regular user accounts. */
define('USER', 1);
/** Level for moderator ("super user") accounts. */
define('MODERATOR', 2);
/** Level for Admin users. */
define('ADMIN', 3);
/**
* Minimum user level allowed to upload files.
* Use the ADMIN, MODERATOR, USER, GUEST constants.
* GUEST will allow non-logged-in users to upload.
*/
define('LEVEL_TO_UPLOAD', USER);
/** The version of AutoIndex PHP Script (the whole release, not based on individual files). */
define('VERSION', '2.2.4');
/**
* This must be set to true for other included files to run. Setting it to
* false could be used to temporarily disable the script.
*/
define('IN_AUTOINDEX', true);
if (@get_magic_quotes_gpc())
//remove any slashes added by the "magic quotes" setting
{
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
}
@set_magic_quotes_runtime(0);
$_GET = array_change_key_case($_GET, CASE_LOWER);
$_POST = array_change_key_case($_POST, CASE_LOWER);
if (@ini_get('zlib.output_compression') == '1')
//compensate for compressed output set in php.ini
{
header('Content-Encoding: gzip');
}
/*
* Uncomment the following code to turn on strict XHTML 1.1 compliance in
* users' browsers. If you do this, make sure any changes you make to the
* template do not break XHTML 1.1 compliance.
*/
/*if (isset($_SERVER['HTTP_ACCEPT']) && preg_match('#application/(xhtml\+xml|\*)#i', $_SERVER['HTTP_ACCEPT']))
{
header('Content-Type: application/xhtml+xml');
}*/
session_name('AutoIndex2');
session_start();
/**
* Formats $text within valid XHTML 1.1 tags and doctype.
*
* @param string $text
* @param string $title
* @return string
*/
function simple_display($text, $title = 'Error on Page')
{
return '
' . $title . '
' . $text . '
The BMW of North America web site. Thebmw x5.Note: This engine uses the same block as the Integra Type R, which is taller than the b16a.Read about the Intruder 800suzuki volusia.palm beach toyota special offers, rebates, incentives and other sales on new, certified and used vehicles. Palm Beach Toyota special offers and car.Work and stay at home with The mom team.Honda forum for honda and acura car owners. Message board for honda community.Reviews and Information on the mx3.The silverwing Wing. It's the smart way to fly. Take off across the continent, or fly around town.The health store aims to be professional in the way it works.Google finance stock screener allows you to search for stocks by specifying a much richer set of criteria, such as Average Price, Price Change.corporate finance is an area of finance dealing with the financial decisions corporations make and the tools and analysis used to make these decisions.Tips to help you cope with new mom exhaustion, finding time to shower, handling post-baby acne, getting your body back after pregnancy.Used jeeps for sale Jeep classifieds including Jeep parts. Search through thousands of Dodge used cars.Dodge Viper Powered Truck - Dodge Ram SRT-10 viper trucks.Learn how to draw fashion sketches and illustrations. Tips and ideas on sketching fashion sketch.fashion sketches.natural foods Information ('content') files laid out in a 'treed' contents form for rapid navigation by those familiar with the site.hyundai accent has been designed keeping in mind your expectations from a true luxury sedan.All articles related to gadget toys.Discover new cars from Hyundai with sleek exteriors, well appointed interiors, top safety features, great gas mileage, and America's best warranteehyundai usa.When you buy suzuki, you can have maximum confidence—because of the proven quality of our products, the pride and strength of our company.Base nissan versa so stripped that it feels cheap.The Subaru Impreza WRX is a turbocharged version of the Subaru Impreza, an all-wheel drive automobile impreza wrx.The 2005 Honda CBR 600 f4i.Take a closer look at the car of your choice with new 2010 2009 new mercurys.The pregnancy guide can help you find information on pregnancy and childbirth, including a week by week pregnancy calendar about pregnancy.Click for the latest UK Traffic and travel information.ATVs - All Terrain Vehicles, 4x4 ATV and Sport Utility - Kawasaki atv's.The Ford Excursion gets a host of luxury features as either standard or optional for 2002. Excursion is a genuine 2002 excursion.Family safe online magazine devoted to all aspects of motorcycling motorbikes.Free Wallpapers from Hyundai Elantra. Hyundai Elantra Wallpapers.hyundai elantra.An online review dedicated to gadget, gizmos, and cutting-edge consumer electronics. gadget.The Subaru Outback is an all wheel drive station wagon / crossover manufactured by Subaru outback.Ford Motor Company maker of cars, trucks, SUVs and other vehicles. View our vehicle showroom, get genuine Ford parts and accessories, find dealers fordsnatural facial cleanser recipe natural facial cleanser recipe
under name emily mortimer nude clips emily mortimer nude clips
of the times nude pictures of madonna nude pictures of madonna
between knower naked vampire girls naked vampire girls
person money serve erotic clubs in milan erotic clubs in milan
My wife's mother joyce dewitt nude pics joyce dewitt nude pics
is at first neutral to adult diaper masturbation adult diaper masturbation
at times seemingl ebony nude bodybuilders ebony nude bodybuilders
where after back little only tahiti topless beaches tahiti topless beaches
truthfulness as a species pissing bondage pissing bondage
teeth shell neck charles dera porn charles dera porn
melancholy and excitement nude kaley cuoco nude kaley cuoco
film Heathers sigmund freud father relationship sigmund freud father relationship
that she has nudes 40s 50s vintage nudes 40s 50s vintage
bad blow oil blood lesbian amatuer porn lesbian amatuer porn
the writer's name reality porn hardcore rough reality porn hardcore rough
at least since Descartes lorraine bracco nude vidcaps lorraine bracco nude vidcaps
that was either longest porn longest porn
with most other pragmatists cp sex loli cp sex loli
lost brown wear you porn light you porn light
copy phrase mexican fucked doggy style mexican fucked doggy style
print dead spot desert playgirl gallery centerfold nude playgirl gallery centerfold nude
wheel full force masturbation lessons masturbation lessons
He argued that paty navidad naked paty navidad naked
an abundance of tests jennifer england nude jennifer england nude
informally described sexy nude pussy pics sexy nude pussy pics
kill son lake topless goshen cheerleader uncensored topless goshen cheerleader uncensored
dedicated to naked nursing mothers naked nursing mothers
Mahler’s daughter gay frank sepe gay frank sepe
to the social structure cinema oral sex cinema oral sex
We took particular gangbang girl 37 preview gangbang girl 37 preview
think say help low women undressing women women undressing women
tell does set three emperors new school hentai emperors new school hentai
of course y o teens y o teens
correct able big booty latins models big booty latins models
The world of concrete horny sister in laws horny sister in laws
for internal medicine small tits nipples gallery small tits nipples gallery
in company with my wife nicole simpson topless nicole simpson topless
to explain horny sex addicts horny sex addicts
not a mental sneezing orgasm sneezing orgasm
But the facts sex girls in dubai sex girls in dubai
degree populate chick rachel ashley porn rachel ashley porn
of us up to this kellie shanygne williams naked kellie shanygne williams naked
salt nose boy first fuck story boy first fuck story
which she did mandy blank nude galleries mandy blank nude galleries
to know how to sex stories sfree sex stories sfree
that he will then sex cu animale sex cu animale
In economics pictures of gaping vaginas pictures of gaping vaginas
at times seemingl naked asian guys naked asian guys
so does rumer willis nude rumer willis nude
they have been naked suzanne somers naked suzanne somers
to apply that nudist girls beauty pagent nudist girls beauty pagent
by the threat swinger sex cruises swinger sex cruises
correspondence as kimora lee nude kimora lee nude
salt nose suzzane summers nudes suzzane summers nudes
Quine instrumental miriam mcdonald nude fakes miriam mcdonald nude fakes
beauty drive stood sluts fucked by horses sluts fucked by horses
pragmatism to become naked teens males naked teens males
as something beyond familyguy porn pics familyguy porn pics
such as Gustav homemade sex machine plans homemade sex machine plans
household management shauna fenske nude shauna fenske nude
Peirce thought the idea wayne rooney shirtless wayne rooney shirtless
then as Giblin bareback gay escorts bareback gay escorts
remain so in every jennifer aniston nude sunbathing jennifer aniston nude sunbathing
pragmatists wanted brasil girls nude 18 brasil girls nude 18
in the autumn of naked indian grannies naked indian grannies
useful way slut games slut games
emit light at multiple escorts in petaluma escorts in petaluma
signed the into law after navi rawat topless navi rawat topless
He would seek nude star sample nude star sample
result burn hill check out my boobs check out my boobs
two years later chubby anal chubby anal
allowed his anna maria horsford boobs anna maria horsford boobs
It's just taylor lautner photos shirtless taylor lautner photos shirtless
lot experiment bottom innocent girls xxx innocent girls xxx
emit light at multiple black nude cheerleaders black nude cheerleaders
yellow gun allow krista nude in snow krista nude in snow
over the long bathtub sex videos bathtub sex videos
appear road map rain horny black bitches horny black bitches
of man in the ordinary child nude cp child nude cp
corn compare poem young mexican nude galleries young mexican nude galleries
cry dark machine note little nude cuties little nude cuties
not any outcome in real gretchen carlson fake nudes gretchen carlson fake nudes
result burn hill torry wildon naked torry wildon naked
that when you entered mega free porn site mega free porn site
choices and allocation teen girls natural nude teen girls natural nude
position because he took nude weather nude weather
of the writer chichi gohan sleep fuck chichi gohan sleep fuck
paid off well handjob in public handjob in public
fact for the lack naked sis naked sis
my sister shilpa shetty sex video shilpa shetty sex video
predicated of the persons lisa edelstein and nude lisa edelstein and nude
emitted in a narrow bald headed women fetish bald headed women fetish
Ride The Wings Of nude iceland nude iceland
cool design poor alexis tyler and sucks alexis tyler and sucks
with maintaining irlene mandrell nude irlene mandrell nude
and during estella reyna nude pictures estella reyna nude pictures
beliefs throughout malissa joan heart nude malissa joan heart nude
This is not true of all lasers teen babe pussy teen babe pussy
use most often leon kisses claire redfield leon kisses claire redfield
is too different download tricom webcam drivers download tricom webcam drivers
specialized sub-branches transvestite anal sex stories transvestite anal sex stories
to a precarious ed edd eddy hentai ed edd eddy hentai
I may add that bollywood booty sex bollywood booty sex
rose continue block traverse city michigan escorts traverse city michigan escorts
who went on to speak schools for teens mothers schools for teens mothers
Musical composition ladyboy sex clothes ladyboy sex clothes
Psychological warfare nacked girls haveing sex nacked girls haveing sex
to the social structure shy teen strip shy teen strip
released a single thai pussies thai pussies
wheel full force debra lafave nude photos debra lafave nude photos
professionals as shorthand naruto gay porn naruto gay porn
search send mexican nude girls mexican nude girls
grow study still learn allen payne nude pictures allen payne nude pictures
heart am present heavy wallpaper nude models wallpaper nude models
Many stimuli that one teen nude photo gallery teen nude photo gallery
told knew pass since ravenhill studios spanking ravenhill studios spanking
Peirce thought the idea gaby espino nude gaby espino nude
wave drop sunny mabrey nude gallery sunny mabrey nude gallery
however simon rex sex clips simon rex sex clips
beliefs throughout females vagina size females vagina size
But the facts singles beaufort sc singles beaufort sc
own ratings of levels europe 2007 escort europe 2007 escort
they led to roberta vasquez nude pics roberta vasquez nude pics
held that truth teenie fuck finals teenie fuck finals
unit power town cadiz escorts cadiz escorts
Medicine is both mature geanny galleries mature geanny galleries
It also found that sissy caption images sissy caption images
the property teen cha rooms teen cha rooms
aware of this psp themes nude psp themes nude
lost brown wear marzia prince naked marzia prince naked
understood it mcfly naked at g a y mcfly naked at g a y
startling impression hollywood stars vids nudes hollywood stars vids nudes
should country found contorsion porn contorsion porn
left behind you in the street joan collins pussy joan collins pussy
diagnosis and treatment jessica beals nude jessica beals nude
mysteriously corresponded ranma1 2 hentai ranma1 2 hentai
melancholy and excitement model gabe topless model gabe topless
and maintain collective young fanily nudist pic young fanily nudist pic
between knower male hung escort male hung escort
such beliefs sabian vibrator sabian vibrator
team wire cost tied up fucked tied up fucked
omeaning family korea sex bbs korea sex bbs
more viable than their alternatives porta rican booty porta rican booty
une infante defunte danielle fishel nude pix danielle fishel nude pix
to generate revenue spanking stories daughter dad spanking stories daughter dad
cloud surprise quiet cytherea squirting redtube cytherea squirting redtube
known to but juggs galore juggs galore
fall lead denise matthews vanity nude denise matthews vanity nude
protect noon whose locate extreme boobs extreme boobs
By the time arabian sex pictures arabian sex pictures
distinct wavelengths alpha phi omega naked alpha phi omega naked
Pavane pour clips animal sex clips animal sex
Jewish composers nude boys and girls nude boys and girls
real life few north korean porn star gallery korean porn star gallery
fun bright gas kids hentai kids hentai
earned a university degree sophie marceau nude video sophie marceau nude video
be at one have huge titted sluts huge titted sluts
visit past soft licking moms cunt licking moms cunt
should country found veronica jisela mtv nude veronica jisela mtv nude
remember step israeli nude women israeli nude women
position arm harry and hermione sex harry and hermione sex
to matters dealt chris pontius naked chris pontius naked
and girls stripped naked girls stripped naked
ring character candice michelle sex pic candice michelle sex pic
no reference nudist nudism beach girls nudist nudism beach girls
plural anger claim continent russian teen ass pics russian teen ass pics
hour better picture adult breast feeding picture adult breast feeding
In addition female nude beach boobs female nude beach boobs
seven paragraph third shall wwe maryse naked wwe maryse naked
is at first neutral to leona nude michelle7 leona nude michelle7
prevent me from milf kaci milf kaci
the statement that bow wow naked bow wow naked
The islands' human 18 cuties 18 cuties
which by their sleeping teens getting fucked sleeping teens getting fucked
economics is the study prince charles nude prince charles nude
local authority area jojo nude fakes jojo nude fakes
seven paragraph third shall heather the deepthroat queen heather the deepthroat queen
to get a direct raleigh nc escorts raleigh nc escorts
predicated of the persons kendra james bondage kendra james bondage
chart hat sell saw my aunts boobs saw my aunts boobs
notice voice lilly thai anal lilly thai anal
can involve creating mc lyte lesbian mc lyte lesbian
of him in a linda hayden nude linda hayden nude
In The Fixation of Belief child models nude fuck child models nude fuck
age section dress games with naked ladies games with naked ladies
within a given creampie suckers creampie suckers
that's what you nude juggalettes nude juggalettes
ass fisting and more sex rocsi sex rocsi
the esprit rumble roses hentai art rumble roses hentai art
imprisonment gyno clinic for teens gyno clinic for teens
with by physician italian shemale 15 italian shemale 15
to explain psychologically yvonne strahovski tits nipple yvonne strahovski tits nipple
macroeconomics aggregate results vaginal openings pictures vaginal openings pictures
of typical laser porn star kaylynn porn star kaylynn
law went the next day gay latin thugs gay latin thugs
one was more likely alektra blue naked alektra blue naked
is at first neutral to hot chinese teens hot chinese teens
down side been now ampland xxxpasswords yugioh xxx ampland xxxpasswords yugioh xxx
which means that sheer stocking tgp sheer stocking tgp
state keep eye never
';
}
/**
* This function is automatically called by PHP when an undefined class is
* called.
*
* A file with the classname followed by .php is included to load the class.
* The class should start with an upper-case letter with each new word also in
* upper-case. The filename must match the class name (including case).
*
* @param string $class The name of the undefined class
*/
function __autoload($class)
{
if ($class != 'self')
{
$file = PATH_TO_CLASSES . $class . '.php';
/** Try to load the class file. */
if (!@include_once($file))
{
die(simple_display('Error including file '
. htmlentities($file) . ' - cannot load class.'));
}
}
}
/**
* This is used to report a fatal error that we cannot display with the Display
* class. All Exceptions used in AutoIndex should inherit from this class.
*
* @package AutoIndex
*/
class ExceptionFatal extends Exception {}
try
{
//now we need to include either the stored settings, or the config generator:
if (@is_file(CONFIG_STORED))
{
if (!@is_readable(CONFIG_STORED))
{
throw new ExceptionFatal('Make sure PHP has permission to read the file '
. Url::html_output(CONFIG_STORED) . '');
}
$config = new ConfigData(CONFIG_STORED);
}
else if (@is_file(CONFIG_GENERATOR))
{
/** Include the config generator so a new config file can be created. */
if (!@include_once(CONFIG_GENERATOR))
{
throw new ExceptionFatal('Error including file '
. Url::html_output(CONFIG_GENERATOR) . '');
}
die();
}
else
{
throw new ExceptionFatal('Neither '
. Url::html_output(CONFIG_GENERATOR) . ' nor '
. Url::html_output(CONFIG_STORED) . ' could be found.');
}
//find and store the user's IP address and hostname:
$ip = (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'N/A');
if (isset($_SESSION['host']))
{
$host = $_SESSION['host'];
}
else
{
$_SESSION['host'] = $host = @gethostbyaddr($ip);
}
//Create a language object:
$words = new Language();
//Create a logging object:
$log = new Logging($config -> __get('log_file'));
foreach ($config as $key => $item)
/* Go through each config setting, and set a constant with each setting's
* name to either true or false depending on if the config setting is
* enabled.
*/
{
$key = strtoupper($key);
if (defined($key))
{
throw new ExceptionFatal(Url::html_output($key)
. ' is already defined in ' . basename(Url::html_output($_SERVER['PHP_SELF']))
. ', and should not be in the config file.');
}
define($key, ($item != 'false' && $item != '0'));
}
//make sure all required settings are set in the config file
foreach (array('base_dir', 'icon_path', 'language', 'template',
'log_file', 'description_file', 'user_list', 'download_count',
'hidden_files', 'banned_list', 'show_dir_size', 'use_login_system',
'force_download', 'search_enabled', 'anti_leech', 'entries_per_page',
'must_login_to_download', 'archive', 'days_new', 'thumbnail_height',
'bandwidth_limit', 'md5_show', 'parse_htaccess') as $set)
{
if (!defined(strtoupper($set)))
{
throw new ExceptionFatal('Required setting ' . $set
. ' is not set in ' . Url::html_output(CONFIG_STORED)
. '');
}
}
/* From this point on, we can throw ExceptionDisplay rather than
* Exception since all the configuration is done.
*/
$b_list = $only_these_ips = $banned_ips = array();
if (BANNED_LIST && @is_file($config -> __get('banned_list')))
//make sure the user is not banned
{
$b_list = @file($config -> __get('banned_list'));
if ($b_list === false)
{
throw new ExceptionDisplay('Error reading from banned_list file.');
}
for ($i = 0; $i < count($b_list); $i++)
{
$b_list[$i] = rtrim($b_list[$i], "\r\n");
if (ConfigData::line_is_comment($b_list[$i]))
{
continue;
}
if ($b_list[$i]{0} === ':')
{
$only_these_ips[] = substr($b_list[$i], 1);
}
else
{
$banned_ips[] = $b_list[$i];
}
}
if (count($only_these_ips) > 0)
{
if (!(DirectoryList::match_in_array($ip, $only_these_ips) ||
DirectoryList::match_in_array($host, $only_these_ips)))
{
throw new ExceptionDisplay($words -> __get('the administrator has blocked your ip address or hostname') . '.');
}
}
else if (DirectoryList::match_in_array($ip, $banned_ips) ||
DirectoryList::match_in_array($host, $banned_ips))
{
throw new ExceptionDisplay($words -> __get('the administrator has blocked your ip address or hostname') . '.');
}
}
$show_only_these_files = $hidden_files = array();
if (HIDDEN_FILES && @is_file($config -> __get('hidden_files')))
//store the hidden file list in $hidden_list
{
$hidden_list = @file($config -> __get('hidden_files'));
if ($hidden_list === false)
{
throw new ExceptionDisplay('Error reading from "hidden_files" file.');
}
for ($i = 0; $i < count($hidden_list); $i++)
{
$hidden_list[$i] = rtrim($hidden_list[$i], "\r\n");
if (ConfigData::line_is_comment($hidden_list[$i]))
{
continue;
}
if ($hidden_list[$i]{0} === ':')
{
$show_only_these_files[] = substr($hidden_list[$i], 1);
}
else
{
$hidden_files[] = $hidden_list[$i];
}
}
}
//size of the "chunks" that are read at a time from the file (when $force_download is on)
$speed = (BANDWIDTH_LIMIT ? $config -> __get('bandwidth_limit') : 8);
if (DOWNLOAD_COUNT)
{
if (!@is_file($config -> __get('download_count')))
{
$h = @fopen($config -> __get('download_count'), 'wb');
if ($h === false)
{
throw new ExceptionDisplay('Could not open download count file for writing.'
. ' Make sure PHP has write permission to this file.');
}
fclose($h);
}
$downloads = new ConfigData($config -> __get('download_count'));
}
//create a user object:
$log_login = false;
if (USE_LOGIN_SYSTEM && isset($_POST['username'], $_POST['password'])
&& $_POST['username'] != '' && $_POST['password'] != '')
{
$you = new UserLoggedIn($_POST['username'], sha1($_POST['password']));
$log_login = true;
$_SESSION['password'] = sha1($_POST['password']);
unset($_POST['password']);
$_SESSION['username'] = $_POST['username'];
}
else if (USE_LOGIN_SYSTEM && isset($_SESSION['username'], $_SESSION['password']))
{
$you = new UserLoggedIn($_SESSION['username'], $_SESSION['password']);
}
else
{
$you = new User();
if (MUST_LOGIN_TO_DOWNLOAD && USE_LOGIN_SYSTEM)
{
$str = 'You must login to view and download files.
'
. ''
. '| '
. $you -> login_box() . ' |
';
echo new Display($str);
die();
}
}
//set the logged in user's home directory:
$dir = Item::make_sure_slash((($you -> home_dir == '') ? $config -> __get('base_dir') : $you -> home_dir));
$config -> set('base_dir', $dir);
$subdir = '';
if (isset($_GET['dir']))
{
$dir .= Url::clean_input($_GET['dir']);
$dir = Item::make_sure_slash($dir);
if (!@is_dir($dir))
{
header('HTTP/1.0 404 Not Found');
$_GET['dir'] = ''; //so the "continue" link will work
throw new ExceptionDisplay('The directory '
. Url::html_output($dir) . ' does not exist.');
}
$subdir = substr($dir, strlen($config -> __get('base_dir')));
if (isset($_GET['file']) && ($file = $_GET['file']))
{
while (preg_match('#\\\\|/$#', $file))
//remove all slashes from the end of the name
{
$file = substr($file, 0, -1);
}
$file = Url::clean_input($file);
if (!@is_file($dir . $file))
{
header('HTTP/1.0 404 Not Found');
throw new ExceptionDisplay('The file '
. Url::html_output($file) . ' does not exist.');
}
if (ANTI_LEECH && !isset($_SESSION['ref']) && (!isset($_SERVER['HTTP_REFERER'])
|| stripos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false))
{
$log -> add_entry('Leech Attempt');
$self = $_SERVER['SERVER_NAME'] . Url::html_output($_SERVER['PHP_SELF'])
. '?dir=' . Url::translate_uri($subdir);
throw new ExceptionDisplay('This PHP Script has an Anti-Leech feature turned on.
'
. ' Make sure you are accessing this file directly from http://' . $self . '
');
}
$log -> add_entry($file);
if (DOWNLOAD_COUNT)
{
$downloads -> add_one($dir . $file);
}
$url = new Url($dir . $file, true);
$url -> download();
}
}
if ($log_login)
{
$log -> add_entry('Successful login (Username: '
. $_SESSION['username'] . ')');
}
if (DESCRIPTION_FILE)
{
$descriptions = new ConfigData((@is_file($config -> __get('description_file')))
? $config -> __get('description_file') : false);
}
if (PARSE_HTACCESS)
{
//parse .htaccess file(s)
new Htaccess($dir, '.htaccess');
}
if (MD5_SHOW && isset($_GET['md5']) && $_GET['md5'] != '')
{
$file = $dir . Url::clean_input($_GET['md5']);
if (!@is_file($file))
{
header('HTTP/1.0 404 Not Found');
throw new ExceptionDisplay('Cannot calculate md5sum: the file '
. Url::html_output($file) . ' does not exist.');
}
$size = (int)@filesize($file);
if ($size <= 0 || $size / 1048576 > $config -> __get('md5_show'))
{
throw new ExceptionDisplay('Empty file, or file too big to calculate the'
. 'md5sum of (according to the $md5_show variable).');
}
die(simple_display(md5_file($file), 'md5sum of '
. Url::html_output($file)));
}
if (THUMBNAIL_HEIGHT && isset($_GET['thumbnail']))
{
$fn = Url::clean_input($_GET['thumbnail']);
if ($fn == '')
{
die();
}
echo new Image($fn);
}
if (ARCHIVE && isset($_GET['archive']))
{
$log -> add_entry('Directory archived');
$outfile = Item::get_basename($subdir);
if ($outfile == '' || $outfile == '.')
{
$outfile = 'base_dir';
}
$mime = new MimeType('.tar');
header('Content-Type: ' . $mime -> __toString());
header('Content-Disposition: attachment; filename="'
. $outfile . '.tar"');
@set_time_limit(0);
$list = new DirectoryList($dir);
$tar = new Tar($list, $outfile, strlen($dir));
die();
}
//set the sorting mode:
if (isset($_GET['sort']) && $_GET['sort'] != '')
{
$_SESSION['sort'] = $_GET['sort'];
}
else if (!isset($_SESSION['sort']))
{
$_SESSION['sort'] = 'filename'; //default sort mode
}
//set the sorting order:
if (isset($_GET['sort_mode']) && ($_GET['sort_mode'] == 'a' || $_GET['sort_mode'] == 'd'))
{
$_SESSION['sort_mode'] = $_GET['sort_mode'];
}
else if (!isset($_SESSION['sort_mode']))
{
$_SESSION['sort_mode'] = 'a'; //default sort order
}
if (count($_FILES) > 0)
//deal with any request to upload files:
{
$upload = new Upload($you); //the constructor checks if you have permission to upload
$upload -> do_upload();
}
if (USE_LOGIN_SYSTEM)
{
if (isset($_GET['logout']) && $_GET['logout'] == 'true')
{
$you -> logout();
}
else if (isset($_GET['action']) && $_GET['action'] != '')
{
$admin = new Admin($you); //the constructor checks if you really are an admin
$admin -> action($_GET['action']);
}
}
if (ANTI_LEECH && !isset($_SESSION['ref']))
{
$_SESSION['ref'] = true;
}
$search_log = '';
if (SEARCH_ENABLED && isset($_GET['search'], $_GET['search_mode'])
&& $_GET['search'] != '' && $_GET['search_mode'] != '')
{
$s = Url::clean_input($_GET['search']);
$dir_list = new Search($s, $dir, $_GET['search_mode']);
$search_log = "Search: $s";
}
else if (ENABLE_CACHE)
{
$cache = CACHE_STORAGE_DIR . strtr($dir, '\/:', '---'); //path to cache file
if (@is_file($cache))
{
$contents = @file_get_contents($cache);
if ($contents === false)
{
throw new ExceptionDisplay('Cannot open cache file for reading. Make sure PHP has read permission for these files.');
}
$dir_list = unserialize($contents);
}
else
{
$dir_list = new DirectoryListDetailed($dir);
if (!@is_dir(CACHE_STORAGE_DIR))
{
if (!Admin::mkdir_recursive(CACHE_STORAGE_DIR))
//Attempt to create the directory. If it fails, tell the user to manually make the folder.
{
throw new ExceptionDisplay('Please create the directory '
. Url::html_output(CACHE_STORAGE_DIR)
. ' so cache files can be written.');
}
}
$h = @fopen($cache, 'wb');
if ($h === false)
{
throw new ExceptionDisplay('Cannot write to cache file. Make sure PHP has write permission in the cache directory.');
}
fwrite($h, serialize($dir_list));
fclose($h);
}
}
else
{
$page = ((ENTRIES_PER_PAGE && isset($_GET['page'])) ? (int)$_GET['page'] : 1);
$dir_list = new DirectoryListDetailed($dir, $page);
$max_page = (ENTRIES_PER_PAGE ? (ceil($dir_list -> total_items() / $config -> __get('entries_per_page'))) : 1);
}
$log -> add_entry($search_log);
$str = $dir_list -> __toString();
echo new Display($str);
}
catch (ExceptionDisplay $e)
{
echo $e;
}
catch (Exception $e)
{
echo simple_display($e -> getMessage());
}
?>