My favorites
▼
|
Sign in
thehostingtool
A PHP-based, open-source, client management script geared towards free web hosting providers.
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
tags
/
1.2.2
/
install
/
index.php
r261
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
//////////////////////////////
// The Hosting Tool
// Install Script
// By Jonny H and Kevin M
// Released under the GNU-GPL
//////////////////////////////
/*
* This is a pretty bad attempt at being secure. If you're having
* problems with it, feel free to comment it out. But it was
* better than what we had before and should work.
*/
/*
* __FILE__ is an absolute path and we need to make it relative to
* the document root. This file must be called directly and
* directly only.
*/
if(strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
$file = str_replace("\\", "/", __FILE__);
$prepend = "/";
}
else {
$file = __FILE__;
$prepend = "";
}
$compare = explode($_SERVER["DOCUMENT_ROOT"], $file);
if($prepend . $compare[1] !== $_SERVER["PHP_SELF"]) {
die("You can only run the install from the <em>".__FILE__."</em> file.");
}
/*
* Quick little function made to make generating a default site URL
* easy. Hopefully this will assist alot of support topics regarding
* bad site URLs, as the automatically generated ones should be correct.
*/
function generateSiteUrl() {
$url = "";
if(!empty($_SERVER["HTTPS"])) {
$url .= "https://";
}
else {
$url .= "http://";
}
$exploded = explode($_SERVER["DOCUMENT_ROOT"], realpath("../"));
$url .= $_SERVER["HTTP_HOST"] . $exploded[1] . "/";
return $url;
}
//INSTALL GLOBALS
define("CVER", "1.2.1");
define("NVER", "1.2.2");
define("LINK", "../includes/"); # Set link
include(LINK."compiler.php"); # Get compiler
function writeconfig($host, $user, $pass, $db, $pre, $true) {
global $style;
$array['HOST'] = $host;
$array['USER'] = $user;
$array['PASS'] = $pass;
$array['DB'] = $db;
$array['PRE'] = $pre;
$array['TRUE'] = $true;
$tpl = $style->replaceVar("tpl/install/conftemp.tpl", $array);
$link = LINK."conf.inc.php";
if(is_writable($link)) {
file_put_contents($link, $tpl);
return true;
}
else {
return false;
}
}
define("THEME", "Reloaded2"); # Set the theme
define("URL", "../"); # Set url to blank
define("NAME", "THT");
define("PAGE", "Install");
define("SUB", "Choose Method");
$array['VERSION'] = NVER;
$array['ANYTHING'] = "";
$link = LINK."conf.inc.php";
$disable = false;
if(INSTALL == 1) {
include(LINK."conf.inc.php");
if(!writeconfig($sql['host'], $sql['user'], $sql['pass'], $sql['db'], $sql['pre'], "false")) {
$array['ANYTHING'] = "Your $link isn't writeable or does not exist! Please CHMOD it to 666 and make sure it exists!!";
$disable = true;
}
else {
$array['ANYTHING'] = "Since you've already ran the install your config has been re-written to not installed. If you are upgrading, this is fine!";
}
}
if(!file_exists($link)) {
$array["ANYTHING"] = "Your $link file doesn't exist! Please create it!";
$disable = true;
}
elseif(!is_writable($link)) {
$array['ANYTHING'] = "Your $link isn't writeable! Please CHMOD it to 666!";
$disable = true;
}
echo $style->get("header.tpl");
if($disable) {
echo '<script type="text/javascript">$(function(){$(".twobutton").attr("disabled", "true");$("#method").attr("disabled", "true");});</script>';
}
$array["GENERATED_URL"] = generateSiteUrl();
echo $style->replaceVar("tpl/install/install.tpl", $array);
echo $style->get("footer.tpl");
include(LINK."output.php"); #Output it
?>
Show details
Hide details
Change log
r46
by kmark937 on Jun 18, 2010
Diff
Added the release tag snapshot for v1.2.2.
Go to:
/tags/1.2.2
/tags/1.2.2/COPYING.txt
/tags/1.2.2/README.txt
/tags/1.2.2/admin
/tags/1.2.2/admin/cache
/tags/1.2.2/admin/cache/index.html
/tags/1.2.2/admin/index.php
/tags/1.2.2/admin/pages
/tags/1.2.2/admin/pages/credits.php
/tags/1.2.2/admin/pages/email.php
/tags/1.2.2/admin/pages/home.php
/tags/1.2.2/admin/pages/import.php
/tags/1.2.2/admin/pages/index.html
...s/1.2.2/admin/pages/invoices.php
/tags/1.2.2/admin/pages/kb.php
/tags/1.2.2/admin/pages/lof.php
/tags/1.2.2/admin/pages/logs.php
...s/1.2.2/admin/pages/packages.php
/tags/1.2.2/admin/pages/pass.php
/tags/1.2.2/admin/pages/servers.php
...s/1.2.2/admin/pages/settings.php
/tags/1.2.2/admin/pages/staff.php
/tags/1.2.2/admin/pages/status.php
...2.2/admin/pages/stylechanger.php
/tags/1.2.2/admin/pages/sub.php
/tags/1.2.2/admin/pages/system.php
/tags/1.2.2/admin/pages/tickets.php
/tags/1.2.2/admin/pages/type.php
/tags/1.2.2/admin/pages/users.php
/tags/1.2.2/client
/tags/1.2.2/client/index.php
/tags/1.2.2/client/pages
/tags/1.2.2/client/pages/delete.php
...s/1.2.2/client/pages/details.php
/tags/1.2.2/client/pages/home.php
/tags/1.2.2/client/pages/index.html
.../1.2.2/client/pages/invoices.php
...s/1.2.2/client/pages/notices.php
...s/1.2.2/client/pages/tickets.php
/tags/1.2.2/client/pages/type.php
/tags/1.2.2/client/pages/view.php
/tags/1.2.2/includes
/tags/1.2.2/includes/ajax.php
...1.2.2/includes/captcha_image.php
/tags/1.2.2/includes/class_db.php
...s/1.2.2/includes/class_email.php
...1.2.2/includes/class_invoice.php
/tags/1.2.2/includes/class_main.php
.../1.2.2/includes/class_server.php
...s/1.2.2/includes/class_style.php
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 3370 bytes, 117 lines
View raw file
Powered by
Google Project Hosting