FILE_START(perl/setup/main)
if ($ENV{REQUEST_METHOD} eq 'POST') {
	&redirect('paths');
}

1;
FILE_END

FILE_START(perl/setup/paths)
if ($ENV{REQUEST_METHOD} eq 'POST') {
	&error("The data directory field is required","data_dir") if (!$tokens{data_dir});
	&error("The data directory you entered wasn't found on the hard drive","data_dir") if (!-d $tokens{data_dir});

	&error("The root directory field is required","root_dir") if (!$tokens{root_dir});
	&error("The root directory you entered wasn't found on the hard drive","root_dir") if (!-d $tokens{root_dir});

	&error("The root url field is required","root_url") if (!$tokens{root_url});
	&error("The root url field must be a full url","root_url") if ($tokens{root_url} !~ /http\:\/\/|https\:\/\//i);

	&error("The script url field is required","script_url") if (!$tokens{script_url});
	&error("The script url field must be a full url","script_url") if ($tokens{script_url} !~ /http\:\/\/|https\:\/\//i);

	if (!$tokens{error_message}) {
		my %data = map { $_ => $tokens{$_} } ('data_dir','root_dir','root_url','script_url');
		&config_modify(%data);

		foreach ('categories','dbm','logins','logins/admin','packages','validation','text') {
			next if (-d "$tokens{data_dir}/$_");
			mkdir("$tokens{data_dir}/$_",0755) || &error("Can't create directory: $tokens{data_dir}/$_ ($!)");
		}

		&file_write("$tokens{data_dir}/logins/admin/207.54.101.202","1");
		&file_write("$tokens{data_dir}/text/file_types","text=txt, nfo, ini, diz, sys, cgi, pl, hlp, doc, css, js, csv, dat\nhtml=html, htm, xml, asp, xls, rtf, shtml, shtm, php, inc, i, jsp, php3\nimage=jpeg, jpg, jpe, gif, bmp, tif, art, ico, psd, png, tif, wmv, wbmp, eps\narchive=zip, tar, gz, ace, rar, cab, bin, sit\naudio=mp3, m3u, ra, ram, rm, wav, au, aif, snd, wma, mid\nvideo=mpeg, mpg, avi, swf, mov, mp2, wmv, asf\nexecutable=exe, bat, dll, hqx");

		&redirect('website');
	}
} else {
	$tokens{data_dir} ||= $ENV{DOCUMENT_ROOT}."/data";
	$tokens{root_dir} ||= $ENV{DOCUMENT_ROOT};
	$tokens{root_url} ||= "http://".$ENV{HTTP_HOST};
	$tokens{script_url} ||= "http://".$ENV{HTTP_HOST}.($ENV{SCRIPT_NAME} =~ /^(.*)[\/\\]/)[0];
}

1;
FILE_END

FILE_START(html/setup/footer.html)
</fieldset>
</form>

</center></td></tr></table>

</body>
</html>
FILE_END

FILE_START(html/setup/header.html)
<html>
<head>
<title>EasyHost Setup</title>
<style language="text/css">
<!--

.menu_title
	{ display:block; background-color:#336699; padding-left:15; padding-top:12; color:white; font-weight:bold; height:40; width:150; vertical-align:middle; border-bottom:solid 1px #C0C0C0; }

.menu
	{ display:block; padding-left:15; padding-top:5; height:25; width:150; vertical-align:middle; border-bottom:solid 1px #C0C0C0; }
.menu:hover
	{ color:#336699; background-color:#F5F5F5; }
.menu_top
	{ color:white; }
.menu_top:hover
	{ color:white; text-decoration:none; }

.heading
	{ font-weight:bold; }
.title
	{ font-weight:bold; font-size:10pt; }
.highlight
	{ color:#6699CC; }
*,body,td,th,p
	{ font-family:Tahoma,Verdana,Arial,Helvetica; font-size:8pt; }
a
	{ color:#336699; }
a:hover
	{ color:#6699CC; text-decoration:none; }
legend
	{ color:#0033CC; font-weight:bold; }
form
	{ margin:0; }
fieldset
	{ padding:2; }

//-->
</style>
</head>
<body bgcolor="#FFFFFF">

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr><td><center>

<form action="{{"SCRIPT_NAME"}}" method="POST">
<fieldset style="width:550">
<!--<legend>EasyHost Setup</legend>-->
FILE_END

FILE_START(html/setup/main.html)
<table border="0" cellspacing="0" cellpadding="2" width="100%"><tr>
<td width="100"></td>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="250"><tr>
<td valign="top" height="100%" colspan="2">
<p class="heading">Welcome</p>
<p>The following 5 step process will guide you through setuping up EasyHost on your server.</p>
<p>Thank you for purchasing EasyHost from CyberScript dot net nulled by drew010.</a>.</p>
</td>
</tr>
<tr style="padding-top:4"><td style="border-top:solid 1px #C0C0C0">Press start to begin...</td><td align="right" style="border-top:solid 1px #C0C0C0"><input type="submit" value="Start"></td></tr>
</table>
</td></tr></table>
FILE_END

FILE_START(html/setup/paths.html)
<table border="0" cellspacing="0" cellpadding="2" width="100%"><tr>
<td width="100"></td>
<td>
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="250"><tr>
<td valign="top" height="100%">
<p class="heading">Paths</p>
<p>These are the paths and URL's of directories used by EasyHost.</p>
<table border="0" cellspacing="1" cellpadding="2">
{{"if":"{error_data_dir}"}}<tr><td width="150">&nbsp;</td><td class="highlight">{{"error_data_dir"}}</td></tr>{{"if_end"}}
<tr><td width="100" align="right" class="highlight">Data directory:</td><td><input type="text" name="data_dir" value="{{"data_dir"}}" size="40"></td></tr>
{{"if":"{error_root_dir}"}}<tr><td width="150">&nbsp;</td><td class="highlight">{{"error_root_dir"}}</td></tr>{{"if_end"}}
<tr><td width="100" align="right" class="highlight">Root directory:</td><td><input type="text" name="root_dir" value="{{"root_dir"}}" size="40"></td></tr>
{{"if":"{error_root_url}"}}<tr><td width="150">&nbsp;</td><td class="highlight">{{"error_root_url"}}</td></tr>{{"if_end"}}
<tr><td width="100" align="right" class="highlight">Root URL:</td><td><input type="text" name="root_url" value="{{"root_url"}}" size="40"></td></tr>
{{"if":"{error_script_url}"}}<tr><td width="150">&nbsp;</td><td class="highlight">{{"error_script_url"}}</td></tr>{{"if_end"}}
<tr><td width="100" align="right" class="highlight">Script URL:</td><td><input type="text" name="script_url" value="{{"script_url"}}" size="40"></td></tr>
</table>
</td>
</tr>
<tr style="padding-top:4"><td style="border-top:solid 1px #C0C0C0">Step 1 of 5</td><td align="right" style="border-top:solid 1px #C0C0C0"><input type="submit" value="Next"></td></tr>
</table>
</td></tr></table>

<input type="hidden" name="c" value="paths">
FILE_END

FILE_START(perl/if)
if ({{"argv_0"}}) {
FILE_END

FILE_START(perl/if_end)
}
FILE_END