39 return $v; |
39 return $v; |
40 } |
40 } |
41 |
41 |
42 // Determine Enano root directory |
42 // Determine Enano root directory |
43 |
43 |
44 $enano_root = dirname(dirname(dirname(__FILE__))); |
44 if ( !defined('ENANO_ROOT') ) |
45 if ( preg_match('#/repo$#', $enano_root) && file_exists("$enano_root/../.enanodev") ) |
|
46 { |
45 { |
47 $enano_root = preg_replace('#/repo$#', '', $enano_root); |
46 $enano_root = dirname(dirname(dirname(__FILE__))); |
|
47 if ( preg_match('#/repo$#', $enano_root) && file_exists("$enano_root/../.enanodev") ) |
|
48 { |
|
49 $enano_root = preg_replace('#/repo$#', '', $enano_root); |
|
50 } |
|
51 |
|
52 define('ENANO_ROOT', $enano_root); |
48 } |
53 } |
49 |
|
50 define('ENANO_ROOT', $enano_root); |
|
51 |
54 |
52 chdir(ENANO_ROOT); |
55 chdir(ENANO_ROOT); |
53 |
56 |
54 // Determine our scriptPath |
57 // Determine our scriptPath |
55 if ( isset($_SERVER['REQUEST_URI']) ) |
58 if ( isset($_SERVER['REQUEST_URI']) && !defined('scriptPath') ) |
56 { |
59 { |
57 // Use reverse-matching to determine where the REQUEST_URI overlaps the Enano root. |
60 // Use reverse-matching to determine where the REQUEST_URI overlaps the Enano root. |
58 $requri = $_SERVER['REQUEST_URI']; |
61 $requri = $_SERVER['REQUEST_URI']; |
59 if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) ) |
62 if ( isset($_SERVER['PATH_INFO']) && !preg_match('/index\.php$/', $_SERVER['PATH_INFO']) ) |
60 { |
63 { |
84 echo '<p>The installer has detected that an installation of Enano already exists on your server. You MUST delete config.php if you wish to reinstall Enano.</p>'; |
87 echo '<p>The installer has detected that an installation of Enano already exists on your server. You MUST delete config.php if you wish to reinstall Enano.</p>'; |
85 $template->footer(); |
88 $template->footer(); |
86 exit(); |
89 exit(); |
87 } |
90 } |
88 |
91 |
89 function microtime_float() |
92 if ( !function_exists('microtime_float') ) |
90 { |
93 { |
91 list($usec, $sec) = explode(" ", microtime()); |
94 function microtime_float() |
92 return ((float)$usec + (float)$sec); |
95 { |
|
96 list($usec, $sec) = explode(" ", microtime()); |
|
97 return ((float)$usec + (float)$sec); |
|
98 } |
93 } |
99 } |
94 |
100 |
95 define('IN_ENANO_INSTALL', 1); |
101 define('IN_ENANO_INSTALL', 1); |
96 |
102 |
97 require(ENANO_ROOT . '/install/includes/ui.php'); |
103 require_once(ENANO_ROOT . '/install/includes/ui.php'); |
98 require(ENANO_ROOT . '/includes/functions.php'); |
104 require_once(ENANO_ROOT . '/includes/functions.php'); |
99 require(ENANO_ROOT . '/includes/json.php'); |
105 require_once(ENANO_ROOT . '/includes/json.php'); |
100 require(ENANO_ROOT . '/includes/constants.php'); |
106 require_once(ENANO_ROOT . '/includes/constants.php'); |
101 require(ENANO_ROOT . '/includes/rijndael.php'); |
107 require_once(ENANO_ROOT . '/includes/rijndael.php'); |
|
108 |
102 // If we have at least PHP 5, load json2 |
109 // If we have at least PHP 5, load json2 |
103 if ( version_compare(PHP_VERSION, '5.0.0', '>=') ) |
110 if ( version_compare(PHP_VERSION, '5.0.0', '>=') ) |
104 { |
111 { |
105 require(ENANO_ROOT . '/includes/json2.php'); |
112 require_once(ENANO_ROOT . '/includes/json2.php'); |
106 } |
113 } |
107 |
114 |
108 strip_magic_quotes_gpc(); |
115 strip_magic_quotes_gpc(); |
109 |
116 |
110 // Build a list of available languages |
117 // Build a list of available languages |