Project

General

Profile

« Previous | Next » 

Revision 1887

Added by Dietmar over 11 years ago

  1. bugfix Notice: Constant messages during new WB installation
    ! update WbDatabase SqlImport parameter,

View differences:

save.php
43 43
 * Set constants for system/install values
44 44
 * @throws RuntimeException
45 45
 */
46
	function _SetInstallPathConstants() {
47
		if(!defined('DEBUG')){ define('DEBUG', false); } // normaly set in config file
48
		if(!defined('ADMIN_DIRECTORY')){ define('ADMIN_DIRECTORY', 'admin'); }
49
		if(!preg_match('/xx[a-z0-9_][a-z0-9_\-\.]+/i', 'xx'.ADMIN_DIRECTORY)) {
50
			throw new RuntimeException('Invalid admin-directory: ' . ADMIN_DIRECTORY);
51
		}
52
		if(!defined('WB_PATH')){ define('WB_PATH', dirname(dirname(__FILE__))); }
53
		if(!defined('ADMIN_URL')){ define('ADMIN_URL', WB_URL.'/'.ADMIN_DIRECTORY); }
54
		if(!defined('ADMIN_PATH')){ define('ADMIN_PATH', WB_PATH.'/'.ADMIN_DIRECTORY); }
55
		if(!defined('WB_REL')){
56
			$x1 = parse_url(WB_URL);
57
			define('WB_REL', (isset($x1['path']) ? $x1['path'] : ''));
58
		}
59
		define('ADMIN_REL', WB_REL.'/'.ADMIN_DIRECTORY);
60
		if(!defined('DOCUMENT_ROOT')) {
61
			
62
			define('DOCUMENT_ROOT', preg_replace('/'.preg_quote(WB_REL, '/').'$/', '', WB_PATH));
63
		}
64
		define('TMP_PATH', WB_PATH.'/temp');
65
	}
66 46

  
67 47
/**
68 48
 * Read DB settings from configuration file
......
122 102
			$db['name'] = isset($db['name']) ? $db['name'] : 'dummy';
123 103
			$db['charset'] = isset($db['charset']) ? $db['charset'] : 'utf8';
124 104
			$db['table_prefix'] = (isset($db['table_prefix']) ? $db['table_prefix'] : '');
125
			define('TABLE_PREFIX', $db['table_prefix']);
105
			if(!defined('TABLE_PREFIX')) {define('TABLE_PREFIX', $db['table_prefix']);}
126 106
			if($sRetvalType == 'dsn') {
127 107
				$aRetval[0] = $db['type'].':dbname='.$db['name'].';host='.$db['host'].';'
128 108
				            . ($db['port'] != '' ? 'port='.(int)$db['port'].';' : '');
......
431 411
$sDbConnectType = 'url'; // depending from class WbDatabase it can be 'url' or 'dsn'
432 412
$aSqlData = _readConfiguration($sDbConnectType);
433 413

  
434
_SetInstallPathConstants();
414
//_SetInstallPathConstants();
415
//$TABLE_PREFIX = $table_prefix;
416
//$WB_PATH = (dirname(dirname(__FILE__)));
417
//$ADMIN_PATH = $WB_PATH.'/admin';
418
if(!defined('WB_PATH')){ define('WB_PATH', dirname(dirname(__FILE__))); }
419
if(!defined('ADMIN_URL')){ define('ADMIN_URL', WB_URL.'/admin'); }
420
if(!defined('ADMIN_PATH')){ define('ADMIN_PATH', WB_PATH.'/admin'); }
435 421

  
436 422
if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
437 423
	set_error('It appears the Absolute path that you entered is incorrect');
......
563 549
	if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
564 550

  
565 551
	require_once(WB_PATH.'/framework/initialize.php');
552
// 
566 553
// Include WB functions file
567 554
	require_once(WB_PATH.'/framework/functions.php');
568 555
// Re-connect to the database, this time using in-build database class

Also available in: Unified diff