Project

General

Profile

« Previous | Next » 

Revision 159

Added by ryan about 19 years ago

Removed relative path input

View differences:

trunk/wb/install/save.php
122 122
// End check to see if form was even submitted
123 123

  
124 124
// Begin path and timezone details code
125
// Check if user has entered the installation path
126
if(!isset($_POST['wb_path']) OR $_POST['wb_path'] == '') {
127
	set_error('Please enter an absolute path');
128
} else {
129
	$wb_path = $_POST['wb_path'];
130
}
125

  
131 126
// Check if user has entered the installation url
132 127
if(!isset($_POST['wb_url']) OR $_POST['wb_url'] == '') {
133 128
	set_error('Please enter an absolute URL');
134 129
} else {
135 130
	$wb_url = $_POST['wb_url'];
136 131
}
137
// Remove any slashes at the end of the URL and path
132
// Remove any slashes at the end of the URL
138 133
if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
139 134
	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
140 135
}
141
if(substr($wb_path, strlen($wb_path)-1, 1) == "/") {
142
	$wb_path = substr($wb_path, 0, strlen($wb_path)-1);
143
}
144 136
if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
145 137
	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
146 138
}
147
if(substr($wb_path, strlen($wb_path)-1, 1) == "\\") {
148
	$wb_path = substr($wb_path, 0, strlen($wb_path)-1);
149
}
150 139
if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
151 140
	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
152 141
}
153
if(substr($wb_path, strlen($wb_path)-1, 1) == "/") {
154
	$wb_path = substr($wb_path, 0, strlen($wb_path)-1);
155
}
156 142
if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
157 143
	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
158 144
}
159
if(substr($wb_path, strlen($wb_path)-1, 1) == "\\") {
160
	$wb_path = substr($wb_path, 0, strlen($wb_path)-1);
161
}
162 145
// Get the default time zone
163 146
if(!isset($_POST['default_timezone']) OR !is_numeric($_POST['default_timezone'])) {
164 147
	set_error('Please select a valid default timezone');
......
275 258
"define('DB_NAME', '$database_name');\n".
276 259
"define('TABLE_PREFIX', '$table_prefix');\n".
277 260
"\n".
278
"define('WB_PATH', '$wb_path');\n".
261
"define('WB_PATH', dirname(__FILE__));\n".
279 262
"define('WB_URL', '$wb_url');\n".
280
"define('ADMIN_PATH', '$wb_path/admin');\n".
263
"define('ADMIN_PATH', WB_PATH.'/admin');\n".
281 264
"define('ADMIN_URL', '$wb_url/admin');\n".
282 265
"\n".
283 266
"require_once(WB_PATH.'/framework/initialize.php');\n".
267
"\n".
284 268
"?>";
285 269

  
286 270
$config_filename = '../config.php';
......
300 284
	set_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
301 285
}
302 286

  
303
// Include configuration file
287
// Define configuration vars
304 288
define('DB_TYPE', 'mysql');
305 289
define('DB_HOST', $database_host);
306 290
define('DB_USERNAME', $database_username);
307 291
define('DB_PASSWORD', $database_password);
308 292
define('DB_NAME', $database_name);
309 293
define('TABLE_PREFIX', $table_prefix);
310
define('WB_PATH', $wb_path);
294
define('WB_PATH', str_replace('/install','',dirname(__FILE__)));
311 295
define('WB_URL', $wb_url);
312
define('ADMIN_PATH', $wb_path.'/admin');
296
define('ADMIN_PATH', WB_PATH.'/admin');
313 297
define('ADMIN_URL', $wb_url.'/admin');
314 298

  
315
//require('../config.php');
316

  
317 299
// Check if the user has entered a correct path
318 300
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
319 301
	set_error('It appears the Absolute path that you entered is incorrect');
......
591 573
	require_once(WB_PATH.'/framework/initialize.php');
592 574
	$wb = new wb();
593 575
	
594
	// Include the pre-installed module install scripts
576
	// Install add-ons
577
	if(!file_exists(WB_PATH.'/install/addons')) {
595 578
	require(WB_PATH.'/modules/wysiwyg/install.php');
596 579
	require(WB_PATH.'/modules/code/install.php');
597 580
	require(WB_PATH.'/modules/news/install.php');
598 581
	require(WB_PATH.'/modules/form/install.php');
599 582
	require(WB_PATH.'/modules/wrapper/install.php');
583
	} else {
584
		
585
	}
600 586
	
601 587
	// Check if there was a database error
602 588
	if($database->is_error()) {
trunk/wb/install/index.php
1 1
<?php
2 2

  
3
// $Id: index.php,v 1.10 2005/06/21 09:14:24 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
183 183
		</tr>
184 184
		<tr>
185 185
			<td style="color: #666666;">
186
				Absolute Path:
187
			</td>
188
			<td>
189
				<?php
190
				// Try to guess installation path
191
				if(isset($_SERVER['SCRIPT_FILENAME']) AND $_SERVER['SCRIPT_FILENAME'] != "") { // This usually works on linux systems
192
					$guessed_path = rtrim(dirname($_SERVER['SCRIPT_FILENAME']), 'install');
193
				} elseif(isset($_SERVER['PATH_TRANSLATED']) AND $_SERVER['PATH_TRANSLATED'] != "") { // This usually works on windows systems
194
					$guessed_path = rtrim(dirname($_SERVER['PATH_TRANSLATED']), 'install');
195
				} else {
196
					$guessed_path = "";
197
				}
198
				?>
199
				<input type="text" tabindex="2" name="wb_path" style="width: 99%;" value="<?php if(isset($_SESSION['wb_path'])) { echo $_SESSION['wb_path']; } else { echo $guessed_path; } ?>" />
200
			</td>
201
		</tr>
202
		<tr>
203
			<td style="color: #666666;">
204 186
				Default Timezone:
205 187
			</td>
206 188
			<td>

Also available in: Unified diff