| @@ -1,222 +1,152 @@ | | | @@ -1,222 +1,152 @@ |
1 | <?php //; echo; echo "YOU NEED TO RUN THIS SCRIPT WITH PHP NOW!"; echo; echo "Try this: lynx -source http://pear.php.net/go-pear | php -q"; echo; exit # -*- PHP -*- | | 1 | <?php //; echo; echo "YOU NEED TO RUN THIS SCRIPT WITH PHP!"; echo; echo "Point your webbrowser to it or run: php -q go-pear.php"; echo; exit # -*- PHP -*- |
2 | # +----------------------------------------------------------------------+ | | | |
3 | # | PHP Version 5 | | | | |
4 | # +----------------------------------------------------------------------+ | | | |
5 | # | Copyright (c) 1997-2005 The PHP Group | | | | |
6 | # +----------------------------------------------------------------------+ | | | |
7 | # | This source file is subject to version 2.02 of the PHP license, | | | | |
8 | # | that is bundled with this package in the file LICENSE, and is | | | | |
9 | # | available at through the world-wide-web at | | | | |
10 | # | http://www.php.net/license/2_02.txt. | | | | |
11 | # | If you did not receive a copy of the PHP license and are unable to | | | | |
12 | # | obtain it through the world-wide-web, please send a note to | | | | |
13 | # | license@php.net so we can mail you a copy immediately. | | | | |
14 | # +----------------------------------------------------------------------+ | | | |
15 | # | Authors: Tomas V.V.Cox <cox@idecnet.com> | | | | |
16 | # | Stig Bakken <ssb@php.net> | | | | |
17 | # | Christian Dickmann <dickmann@php.net> | | | | |
18 | # | Pierre-Alain Joye <pierre@php.net> | | | | |
19 | # | Greg Beaver <cellog@php.net> | | | | |
20 | # +----------------------------------------------------------------------+ | | | |
21 | # | | 2 | # |
22 | # $Id: go-pear.php,v 1.1.1.1 2007/05/05 21:21:47 adrianp Exp $ | | 3 | # The PEAR installation wizard, both webbased or command line. |
23 | # | | 4 | # |
24 | # Id: go-pear,v 1.104 2007/03/17 21:43:08 cellog Exp | | 5 | # Webbased installation: |
25 | # | | 6 | # 1) Download this file and save it as go-pear.php |
26 | # Automatically download all the files needed to run the "pear" command | | 7 | # 2) Put go-pear.php on your webserver, where you would put your website |
27 | # (the PEAR package installer). Requires PHP 4.1.0 or newer. | | 8 | # 3) Open http://yourdomain.example.org/go-pear.php in your browser |
28 | # | | 9 | # 4) Follow the instructions, done! |
29 | # Installation: Linux | | 10 | # |
30 | # | | 11 | # Command-line installation (for advanced users): |
31 | # This script can either be directly launched or passed via lynx like this. | | 12 | # 1) Download this file and save it as go-pear.php |
32 | # | | 13 | # 2) Open a terminal/command prompt and type: php -q go-pear.php |
33 | # $ lynx -source http://pear.php.net/go-pear | php | | 14 | # 3) Follow the instructions, done! |
34 | # | | 15 | # |
35 | # The above assumes your php binary is named php and that it's | | 16 | # Notes: |
36 | # executable through your PATH: | | 17 | # * Get the latest go-pear version from http://pear.php.net/go-pear |
37 | # | | 18 | # * This installer requires PHP 4.3.0 or newer. |
38 | # Installation: Windows | | 19 | # * On windows, the PHP CLI binary is php.exe, don't forget the -q option if using the CGI binary. |
39 | # | | 20 | # * The default for the command-line installation is a system-wide configuration file, For a local install use: php -q go-pear.php local |
40 | # On Windows, go-pear uses stdin for user input, so you must download | | 21 | |
41 | # go-pear first and then run it: | | 22 | /** |
42 | # | | 23 | * go-pear is the online PEAR installer: just download it and run it |
43 | # Note: In PHP 4.2.0-4.2.3, the PHP CLI binary is named php-cli.exe while since | | 24 | * (through a browser or command line), it will set up a minimal PEAR |
44 | # PHP 4.3.0, it's simply named php.exe in the cli/ folder of your PHP directory. | | 25 | * installation that will be ready for immediate use. |
45 | # The CGI is also named php.exe but it sits directly in your PHP directory. | | 26 | * |
46 | # | | 27 | * @license http://www.php.net/license/2_02.txt PHP License 2.02 |
47 | # > cli/php -r "readfile('http://pear.php.net/go-pear');" > go-pear | | 28 | * @version CVS: Id: go-pear 281637 2009-06-04 08:51:45Z clockwerx |
48 | # > cli/php go-pear | | 29 | * @link http://pear.php.net/package/pearweb_gopear |
49 | # | | 30 | * @author Tomas V.V.Cox <cox@idecnet.com> |
50 | # In PHP 5.0.0+, the PHP CLI binary is php.exe | | 31 | * @author Stig Bakken <ssb@php.net> |
51 | # | | 32 | * @author Christian Dickmann <dickmann@php.net> |
52 | # > php -r "readfile('http://pear.php.net/go-pear');" > go-pear | | 33 | * @author Pierre-Alain Joye <pierre@php.net> |
53 | # > php go-pear | | 34 | * @author Greg Beaver <cellog@php.net> |
54 | # | | 35 | * @author Tias Guns <tias@ulyssis.org> |
55 | # Installation: Notes | | 36 | */ |
56 | # | | 37 | |
57 | # - If using the CGI version of PHP, append the -q option to suppress | | 38 | /* $NetBSD: go-pear.php,v 1.2 2009/10/29 08:29:03 seb Exp $ */ |
58 | # headers in the output. | | | |
59 | # - By default, go-pear will install a system-wide configuration file. For | | | |
60 | # a local install use: | | | |
61 | # > php go-pear local | | | |
62 | # | | | |
63 | # - Once the go-pear script is initiated, you will see instructions on | | | |
64 | # how to continue installing PEAR. The first thing you should see is: | | | |
65 | # | | | |
66 | # Welcome to go-pear! | | | |
67 | # | | | |
68 | # Installation: Web browser | | | |
69 | # | | | |
70 | # You can now use go-pear via a webbrowser, thanks to Christian Dickmann. It is | | | |
71 | # still beta codes, but feel free to test it: | | | |
72 | # 1.: Download the go-pear script by using the "Save target as ..." function | | | |
73 | # of your browser here. | | | |
74 | # | | | |
75 | # 2.: Place the go-pear file somewhere under the document root of your webserver. | | | |
76 | # The easiest way is to create a new directory for pear and to put the file in there. | | | |
77 | # Be sure your web server is setup to recognize PHP, and that you use an appropriate | | | |
78 | # extension. For example, you might name this file gopear.php | | | |
79 | # | | | |
80 | # 3.: Access go-pear through your webserver and follow the instructions. Please | | | |
81 | # make sure that PHP has write access to the dir you want to install PEAR into. | | | |
82 | # For example: http://localhost/pear/gopear.php | | | |
83 | # | | | |
84 | # 4.: After running go-pear you get a link to the Web Frontend of the PEAR installer. | | | |
85 | # I suggest bookmarking this link. | | | |
86 | # | | | |
87 | # 5.: Protect the Web Frontend directory and the go-pear script with a password. | | | |
88 | # Use .htaccess on Apache webservers for example. | | | |
89 | # | | | |
90 | # | | | |
91 | function dump($var) { | | | |
92 | if (defined('WEBINSTALLER') && WEBINSTALLER == 'cgi') { | | | |
93 | echo '<pre>'; | | | |
94 | print_r($var); | | | |
95 | echo '</pre>'; | | | |
96 | } else { | | | |
97 | print_r($var); | | | |
98 | echo "\n"; | | | |
99 | } | | | |
100 | } | | | |
101 | | | 39 | |
102 | $sapi_name = php_sapi_name(); | | 40 | $sapi_name = php_sapi_name(); |
103 | | | 41 | |
104 | $safe_mode = (bool)ini_get('safe_mode'); | | 42 | $safe_mode = (bool)ini_get('safe_mode'); |
105 | if (!$safe_mode) { | | 43 | if (!$safe_mode) { |
106 | set_time_limit(0); | | 44 | set_time_limit(0); |
107 | } | | 45 | } |
108 | | | 46 | |
109 | | | | |
110 | | | | |
111 | @ob_end_clean(); | | 47 | @ob_end_clean(); |
112 | ob_implicit_flush(true); | | 48 | ob_implicit_flush(true); |
113 | define('WEBINSTALLER', ($sapi_name != 'cli' && !(substr($sapi_name,0,3)=='cgi' && !isset($_SERVER['GATEWAY_INTERFACE'])))); | | 49 | define('WEBINSTALLER', ($sapi_name != 'cli' && !(substr($sapi_name,0,3)=='cgi' && !isset($_SERVER['GATEWAY_INTERFACE'])))); |
114 | | | 50 | |
115 | ini_set('track_errors', true); | | 51 | ini_set('track_errors', true); |
116 | ini_set('html_errors', WEBINSTALLER); | | 52 | ini_set('html_errors', WEBINSTALLER); |
117 | ini_set('magic_quotes_runtime', false); | | 53 | ini_set('magic_quotes_runtime', false); |
118 | error_reporting( E_ALL & ~E_NOTICE); | | 54 | error_reporting( E_ALL & ~E_NOTICE); |
119 | | | 55 | |
120 | define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN')); | | 56 | define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN')); |
121 | define('GO_PEAR_VER', '0.6.0'); | | 57 | define('GO_PEAR_VER', '1.1.2'); |
122 | | | | |
123 | if (!function_exists('file_get_contents')) { | | | |
124 | function file_get_contents($filename) | | | |
125 | { | | | |
126 | $fp = fopen($filename, 'rb'); | | | |
127 | $ret = ''; | | | |
128 | while (!feof($fp)) { | | | |
129 | $ret .= fread($fp, 8092);; | | | |
130 | } | | | |
131 | return $ret; | | | |
132 | } | | | |
133 | } | | | |
134 | | | 58 | |
135 | define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli' && which('cscript')); | | 59 | define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli' && which('cscript')); |
136 | | | 60 | |
137 | /* | | 61 | /* |
138 | * See bug #23069 | | 62 | * See bug #23069 |
139 | */ | | 63 | */ |
140 | if ( WEBINSTALLER && WINDOWS ) { | | 64 | if ( WEBINSTALLER && WINDOWS ) { |
141 | $php_sapi_name = win32DetectPHPSAPI(); | | 65 | $php_sapi_name = win32DetectPHPSAPI(); |
142 | if($php_sapi_name=='cgi'){ | | 66 | if($php_sapi_name=='cgi'){ |
143 | $msg = nl2br(" | | 67 | $msg = nl2br(" |
144 | Sorry! The PEAR installer actually does not work on Windows platform using CGI and Apache. | | 68 | Sorry! The PEAR installer actually does not work on Windows platform |
145 | Please install the module SAPI (see http://www.php.net/manual/en/install.apache.php for the | | 69 | using CGI and Apache. Please install the module SAPI (see |
146 | instructions) or use the CLI (cli\php.exe) in the console. | | 70 | http://www.php.net/manual/en/install.apache.php for the instructions) or |
| | | 71 | use the CLI (cli\php.exe) in the console. |
147 | "); | | 72 | "); |
148 | displayHTML('error', $msg); | | 73 | displayHTML('error', $msg); |
149 | } | | 74 | } |
150 | } | | 75 | } |
151 | | | 76 | |
152 | if (WEBINSTALLER && isset($_GET['action']) && $_GET['action'] == 'img' && isset($_GET['img'])) { | | 77 | if (WEBINSTALLER && isset($_GET['action']) && $_GET['action'] == 'img' && isset($_GET['img'])) { |
153 | switch ($_GET['img']) | | 78 | switch ($_GET['img']) |
154 | { | | 79 | { |
155 | case 'note': | | 80 | case 'note': |
156 | case 'pearlogo': | | 81 | case 'pearlogo': |
157 | case 'smallpear': | | 82 | case 'smallpear': |
158 | showImage($_GET['img']); | | 83 | showImage($_GET['img']); |
159 | exit; | | 84 | exit; |
160 | default: | | 85 | default: |
161 | exit; | | 86 | exit; |
162 | }; | | 87 | }; |
163 | } | | 88 | } |
164 | | | 89 | |
165 | // Check if PHP version is sufficient | | 90 | // Check if PHP version is sufficient |
166 | if (function_exists("version_compare") && version_compare(phpversion(), "4.2.0",'<')) { | | 91 | if (function_exists("version_compare") && version_compare(phpversion(), "4.3.0",'<')) { |
167 | die("Sorry! Your PHP version is too old. PEAR and this script requires at | | 92 | die("Sorry! Your PHP version is too old. PEAR and this script requires at |
168 | least PHP 4.2.0 for stable operation. | | 93 | least PHP 4.3.0 for stable operation. |
169 | | | 94 | |
170 | It may be that you have a newer version of PHP installed in your web | | 95 | It may be that you have a newer version of PHP installed in your web |
171 | server, but an older version installed as the 'php' command. In this | | 96 | server, but an older version installed as the 'php' command. In this |
172 | case, you need to rebuilt PHP from source. | | 97 | case, you need to rebuilt PHP from source. |
173 | | | | |
174 | If your source is 4.2.x, you need to run 'configure' with the | | | |
175 | --enable-cli option, rebuild and copy sapi/cli/php somewhere. | | | |
176 | | | | |
177 | If your source is 4.3.x or newer, just make sure you don't run | | 98 | If your source is 4.3.x or newer, just make sure you don't run |
178 | 'configure' with --disable-cli, rebuilt and copy sapi/cli/php. | | 99 | 'configure' with --disable-cli, rebuilt and copy sapi/cli/php. |
179 | | | 100 | |
180 | Please upgrade PHP to a newer version, and try again. See you then. | | 101 | Please upgrade PHP to a newer version, and try again. See you then. |
181 | | | 102 | |
182 | "); | | 103 | "); |
183 | } | | 104 | } |
184 | | | 105 | |
| | | 106 | $gopear_bundle_dir = dirname(__FILE__).'/go-pear-bundle'; |
| | | 107 | |
| | | 108 | $bootstrap_files = array( |
| | | 109 | 'PEAR.php' => 'http://cvs.php.net/viewvc.cgi/pear-core/PEAR.php?view=co&pathrev=PEAR_1_4', |
| | | 110 | 'Archive/Tar.php' => 'http://cvs.php.net/viewvc.cgi/pear/Archive_Tar/Archive/Tar.php?view=co&pathrev=RELEASE_1_3_2', |
| | | 111 | 'Console/Getopt.php' => 'http://cvs.php.net/viewvc.cgi/pear-core/Console/Getopt.php?view=co&pathrev=PEAR_1_4', |
| | | 112 | ); |
| | | 113 | |
| | | 114 | $bootstrap_pkgs = array( // uses URL like http://pear.php.net/get/%s |
| | | 115 | 'PEAR', |
| | | 116 | 'Structures_Graph' |
| | | 117 | ); |
| | | 118 | |
185 | $installer_packages = array( | | 119 | $installer_packages = array( |
186 | 'PEAR-stable', | | 120 | 'PEAR', |
| | | 121 | 'Structures_Graph-stable', |
187 | 'Archive_Tar-stable', | | 122 | 'Archive_Tar-stable', |
188 | 'Console_Getopt-stable', | | 123 | 'Console_Getopt-stable', |
189 | 'Structures_Graph-stable', | | 124 | ); |
190 | ); | | | |
191 | | | | |
192 | if (WEBINSTALLER) { | | | |
193 | $installer_packages[] = 'HTML_Template_IT-stable'; | | | |
194 | $installer_packages[] = 'Net_UserAgent_Detect-stable'; | | | |
195 | $installer_packages[] = 'PEAR_Frontend_Web-alpha'; | | | |
196 | } | | | |
197 | | | 125 | |
198 | $pfc_packages = array( | | 126 | $pfc_packages = array( |
199 | 'MDB2', | | 127 | 'PEAR_Frontend_Web-beta' => 'Webbased PEAR Installer', |
| | | 128 | 'PEAR_Frontend_Gtk2' => 'Graphical PEAR installer based on PHP-Gtk2', |
| | | 129 | 'MDB2' => 'database abstraction layer.', |
200 | ); | | 130 | ); |
201 | | | 131 | |
202 | $config_desc = array( | | 132 | $config_desc = array( |
203 | 'prefix' => 'Installation prefix', | | 133 | 'prefix' => 'Installation prefix ($prefix)', |
| | | 134 | 'temp_dir' => 'Temporary files directory', |
204 | 'bin_dir' => 'Binaries directory', | | 135 | 'bin_dir' => 'Binaries directory', |
205 | 'php_dir' => 'PHP code directory ($php_dir)', | | 136 | 'php_dir' => 'PHP code directory ($php_dir)', |
206 | 'doc_dir' => 'Documentation base directory', | | 137 | 'doc_dir' => 'Documentation base directory', |
207 | 'data_dir' => 'Data base directory', | | 138 | 'data_dir' => 'Data base directory', |
208 | 'test_dir' => 'Tests base directory', | | 139 | 'test_dir' => 'Tests base directory', |
209 | 'temp_dir' => 'Temporary files directory' | | | |
210 | ); | | 140 | ); |
211 | | | 141 | |
212 | if(!WEBINSTALLER && WINDOWS){ | | 142 | if(!WEBINSTALLER && WINDOWS){ |
213 | $config_desc['php_bin'] = 'php.exe path'; | | 143 | $config_desc['php_bin'] = 'php.exe path'; |
214 | } | | 144 | } |
215 | | | 145 | |
216 | if (WEBINSTALLER) { | | 146 | if (WEBINSTALLER) { |
217 | $config_desc['cache_dir'] = 'PEAR Installer cache directory'; | | 147 | $config_desc['cache_dir'] = 'PEAR Installer cache directory'; |
218 | $config_desc['cache_ttl'] = 'Cache TimeToLive'; | | 148 | $config_desc['cache_ttl'] = 'Cache TimeToLive'; |
219 | $config_desc['webfrontend_file'] = 'Filename of WebFrontend'; | | 149 | $config_desc['webfrontend_file'] = 'Filename of WebFrontend'; |
220 | $config_desc['php_bin'] = "php.exe path, optional (CLI command tools)"; | | 150 | $config_desc['php_bin'] = "php.exe path, optional (CLI command tools)"; |
221 | } | | 151 | } |
222 | | | 152 | |
| @@ -225,126 +155,137 @@ if (my_env('HTTP_PROXY')) { | | | @@ -225,126 +155,137 @@ if (my_env('HTTP_PROXY')) { |
225 | } elseif (my_env('http_proxy')) { | | 155 | } elseif (my_env('http_proxy')) { |
226 | $http_proxy = my_env('http_proxy'); | | 156 | $http_proxy = my_env('http_proxy'); |
227 | } else { | | 157 | } else { |
228 | $http_proxy = ''; | | 158 | $http_proxy = ''; |
229 | } | | 159 | } |
230 | | | 160 | |
231 | register_shutdown_function('bail'); | | 161 | register_shutdown_function('bail'); |
232 | | | 162 | |
233 | detect_install_dirs(); | | 163 | detect_install_dirs(); |
234 | | | 164 | |
235 | if (WEBINSTALLER) { | | 165 | if (WEBINSTALLER) { |
236 | @session_start(); | | 166 | @session_start(); |
237 | | | 167 | |
238 | /* | | 168 | // If welcome, just welcome |
239 | See bug #23069 | | 169 | if (!isset($_GET['step'])) { |
240 | */ | | 170 | $_GET['step'] = 'Welcome'; |
241 | if ( WINDOWS ) { | | 171 | /* clean up old sessions datas */ |
242 | $php_sapi_name = win32DetectPHPSAPI(); | | 172 | session_destroy(); |
243 | if($php_sapi_name=='cgi'){ | | 173 | } |
244 | $msg = " | | 174 | if ($_GET['step'] == 'Welcome') { |
245 | Sorry! The PEAR installer actually does not work on Windows platform using CGI and Apache. | | 175 | displayHTML('Welcome'); |
246 | Please install the module SAPI (see http://www.php.net/manual/en/install.apache.php for the | | 176 | exit(); |
247 | instructions) or use the CLI (cli\php.exe) in the console. | | | |
248 | "; | | | |
249 | displayHTML('error', $msg); | | | |
250 | exit(); | | | |
251 | } | | | |
252 | } | | 177 | } |
253 | | | 178 | |
254 | if (!isset($_SESSION['go-pear']) || isset($_GET['restart'])) { | | 179 | if (!isset($_SESSION['go-pear']) || isset($_GET['restart'])) { |
255 | $_SESSION['go-pear'] = array( | | 180 | $_SESSION['go-pear'] = array( |
256 | 'http_proxy' => $http_proxy, | | 181 | 'http_proxy' => $http_proxy, |
257 | 'config' => array( | | 182 | 'config' => array( |
258 | 'prefix' => dirname(__FILE__), | | 183 | 'prefix' => dirname(__FILE__), |
259 | 'bin_dir' => $bin_dir, | | 184 | 'bin_dir' => $bin_dir, |
260 | 'php_bin' => $php_bin, | | 185 | 'php_bin' => $php_bin, |
261 | 'php_dir' => '$prefix/PEAR', | | 186 | 'php_dir' => '$prefix/PEAR', |
262 | 'doc_dir' => $doc_dir, | | 187 | 'doc_dir' => $doc_dir, |
263 | 'data_dir' => $data_dir, | | 188 | 'data_dir' => $data_dir, |
264 | 'test_dir' => $test_dir, | | 189 | 'test_dir' => $test_dir, |
265 | 'temp_dir' => '$prefix/temp', | | 190 | 'temp_dir' => '$prefix/temp', |
266 | 'cache_dir' => '$php_dir/cache', | | 191 | 'cache_dir' => '$php_dir/cache', |
267 | 'cache_ttl' => 300, | | 192 | 'cache_ttl' => 300, |
268 | 'webfrontend_file' => '$prefix/index.php', | | 193 | 'webfrontend_file' => '$prefix/index.php', |
269 | ), | | 194 | ), |
270 | 'install_pfc' => true, | | 195 | 'install_pfc' => true, |
| | | 196 | 'install_optional_packages' => array(), |
271 | 'DHTML' => true, | | 197 | 'DHTML' => true, |
272 | ); | | 198 | ); |
273 | } | | 199 | } |
274 | | | 200 | |
275 | if (!isset($_GET['step'])) { | | 201 | // save submited values |
276 | $_GET['step'] = 'Welcome'; | | | |
277 | /* clean up old sessions datas */ | | | |
278 | session_destroy(); | | | |
279 | } | | | |
280 | if ($_GET['step'] == 'install') { | | 202 | if ($_GET['step'] == 'install') { |
281 | $_SESSION['go-pear']['http_proxy'] = strip_magic_quotes($_POST['proxy']['host']).':'.strip_magic_quotes($_POST['proxy']['port']); | | 203 | $_SESSION['go-pear']['http_proxy'] = strip_magic_quotes($_POST['proxy']['host']).':'.strip_magic_quotes($_POST['proxy']['port']); |
282 | if ($_SESSION['go-pear']['http_proxy'] == ':') { | | 204 | if ($_SESSION['go-pear']['http_proxy'] == ':') { |
283 | $_SESSION['go-pear']['http_proxy'] = ''; | | 205 | $_SESSION['go-pear']['http_proxy'] = ''; |
284 | }; | | 206 | }; |
285 | | | 207 | |
286 | $www_errors = array(); | | 208 | $config_errors = array(); |
287 | foreach($_POST['config'] as $key => $value) { | | 209 | foreach($_POST['config'] as $key => $value) { |
288 | $_POST['config'][$key] = strip_magic_quotes($value); | | 210 | $_POST['config'][$key] = strip_magic_quotes($value); |
289 | if($key!='cache_ttl'){ | | 211 | if ($key != 'cache_ttl' && $key != 'php_bin') { |
290 | if ( empty($_POST['config'][$key]) ) { | | 212 | if ( empty($_POST['config'][$key]) ) { |
291 | if (WEBINSTALLER && $key!='php_bin' ) { | | 213 | $config_errors[$key] = 'Please fill this path, you can use $prefix, $php_dir or a full path.'; |
292 | $www_errors[$key] = 'Please fill this path, you can use $prefix, $php_dir or a full path.'; | | | |
293 | } | | | |
294 | } | | 214 | } |
295 | } | | 215 | } |
296 | } | | 216 | } |
297 | | | 217 | |
298 | if( sizeof($www_errors)>0){ | | 218 | if( sizeof($config_errors)>0){ |
299 | $_GET['step'] = 'config'; | | 219 | $_GET['step'] = 'config'; |
300 | } | | 220 | } |
301 | | | 221 | |
302 | $_SESSION['go-pear']['config'] = $_POST['config']; | | 222 | $_SESSION['go-pear']['config'] = $_POST['config']; |
303 | $_SESSION['go-pear']['install_pfc'] = (isset($_POST['install_pfc']) && $_POST['install_pfc'] == 'on'); | | 223 | $_SESSION['go-pear']['install_pfc'] = (isset($_POST['install_pfc']) && $_POST['install_pfc'] == 'on'); |
| | | 224 | // webinstaller allows to choose pfc packages individually |
| | | 225 | foreach ($pfc_packages as $key => $value) { |
| | | 226 | $pos = array_search($key, $_SESSION['go-pear']['install_optional_packages']); |
| | | 227 | if (isset($_POST[$key]) && $_POST[$key] == 'on' && $pos === false) { |
| | | 228 | $_SESSION['go-pear']['install_optional_packages'][] = $key; |
| | | 229 | } |
| | | 230 | if (!isset($_POST[$key]) && $pos !== false) { |
| | | 231 | unset($_SESSION['go-pear']['install_optional_packages'][$pos]); |
| | | 232 | } |
| | | 233 | } |
304 | $_SESSION['go-pear']['DHTML'] = isset($_POST['BCmode']) ? false : true; | | 234 | $_SESSION['go-pear']['DHTML'] = isset($_POST['BCmode']) ? false : true; |
305 | } | | 235 | } |
306 | | | 236 | |
| | | 237 | // export session values |
307 | $http_proxy = $_SESSION['go-pear']['http_proxy']; | | 238 | $http_proxy = $_SESSION['go-pear']['http_proxy']; |
| | | 239 | $GLOBALS['config_vars'] = array_keys($config_desc); |
| | | 240 | array_unshift($GLOBALS['config_vars'], ''); |
| | | 241 | unset($GLOBALS['config_vars'][0]); // make indices run from 1... |
308 | foreach($_SESSION['go-pear']['config'] as $var => $value) { | | 242 | foreach($_SESSION['go-pear']['config'] as $var => $value) { |
309 | $$var = $value; | | 243 | $$var = $value; |
310 | } | | 244 | } |
311 | $install_pfc = $_SESSION['go-pear']['install_pfc']; | | 245 | $install_pfc = $_SESSION['go-pear']['install_pfc']; |
| | | 246 | $install_optional_packages = $_SESSION['go-pear']['install_optional_packages']; |
| | | 247 | |
| | | 248 | if ($_GET['step'] == 'config') { |
| | | 249 | displayHTML('config'); |
| | | 250 | exit(); |
| | | 251 | } |
| | | 252 | // Anything past this step has something to do with the installation |
312 | } | | 253 | } |
313 | | | 254 | |
314 | if (!WEBINSTALLER) { | | 255 | if (!WEBINSTALLER) { |
315 | $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r'); | | 256 | $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r'); |
316 | | | 257 | |
317 | if (!$tty) { | | 258 | if (!$tty) { |
318 | $tty = fopen('php://stdin', 'r'); | | 259 | $tty = fopen('php://stdin', 'r'); |
319 | } | | 260 | } |
320 | | | 261 | |
321 | $local = isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local'; | | 262 | $local = isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local'; |
322 | if ($local) { | | 263 | if ($local) { |
323 | $local = " | | 264 | $local = " |
324 | Running in local install mode | | 265 | Running in local install mode |
325 | "; | | 266 | "; |
326 | } elseif (WINDOWS) { | | 267 | } elseif (WINDOWS) { |
327 | $local = " | | 268 | $local = " |
328 | Use 'php " . $_SERVER['argv'][0] . " local' to install a local copy of PEAR. | | 269 | Use 'php " . $_SERVER['argv'][0] . " local' to install a local copy of PEAR. |
329 | "; | | 270 | "; |
330 | } | | 271 | } |
331 | print "Welcome to go-pear! | | 272 | print "Welcome to go-pear! |
332 | | | 273 | |
333 | Go-pear will install the 'pear' command and all the files needed by | | 274 | Go-pear will install the 'pear' command and all the files needed by |
334 | it. This command is your tool for PEAR installation and maintenance. | | 275 | it. This command is your tool for PEAR installation and maintenance. |
335 | $local | | 276 | $local |
336 | Go-pear also lets you download and install the PEAR packages bundled | | 277 | Go-pear also lets you download and install the following optional PEAR |
337 | with PHP: " . implode(', ', $pfc_packages) . ". | | 278 | packages: " . implode(', ', array_keys($pfc_packages)) . ". |
338 | | | 279 | |
339 | | | 280 | |
340 | If you wish to abort, press Control-C now, or press Enter to continue: "; | | 281 | If you wish to abort, press Control-C now, or press Enter to continue: "; |
341 | | | 282 | |
342 | fgets($tty, 1024); | | 283 | fgets($tty, 1024); |
343 | | | 284 | |
344 | print "\n"; | | 285 | print "\n"; |
345 | | | 286 | |
346 | print "HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none:"; | | 287 | print "HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none:"; |
347 | | | 288 | |
348 | if (!empty($http_proxy)) { | | 289 | if (!empty($http_proxy)) { |
349 | print " [$http_proxy]"; | | 290 | print " [$http_proxy]"; |
350 | } | | 291 | } |
| @@ -359,46 +300,26 @@ $origpwd = getcwd(); | | | @@ -359,46 +300,26 @@ $origpwd = getcwd(); |
359 | | | 300 | |
360 | $config_vars = array_keys($config_desc); | | 301 | $config_vars = array_keys($config_desc); |
361 | | | 302 | |
362 | // make indices run from 1... | | 303 | // make indices run from 1... |
363 | array_unshift($config_vars, ""); | | 304 | array_unshift($config_vars, ""); |
364 | unset($config_vars[0]); | | 305 | unset($config_vars[0]); |
365 | reset($config_vars); | | 306 | reset($config_vars); |
366 | $desclen = max(array_map('strlen', $config_desc)); | | 307 | $desclen = max(array_map('strlen', $config_desc)); |
367 | $descfmt = "%-{$desclen}s"; | | 308 | $descfmt = "%-{$desclen}s"; |
368 | $first = key($config_vars); | | 309 | $first = key($config_vars); |
369 | end($config_vars); | | 310 | end($config_vars); |
370 | $last = key($config_vars); | | 311 | $last = key($config_vars); |
371 | | | 312 | |
372 | if (WEBINSTALLER) { | | | |
373 | if ( isset($www_errors) && sizeof($www_errors) ) { | | | |
374 | displayHTML('config'); | | | |
375 | exit(); | | | |
376 | } else { | | | |
377 | if (isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'] == true && $_GET['step'] == 'install') { | | | |
378 | $_GET['step'] = 'preinstall'; | | | |
379 | } | | | |
380 | if ($_GET['step'] != 'install' && $_GET['step'] != 'install-progress') { | | | |
381 | displayHTML($_GET['step']); | | | |
382 | exit; | | | |
383 | } | | | |
384 | if ($_GET['step'] == 'install-progress') { | | | |
385 | displayHTMLHeader(); | | | |
386 | echo "Starting installation ...<br/>"; | | | |
387 | } | | | |
388 | ob_start(); | | | |
389 | } | | | |
390 | } | | | |
391 | | | | |
392 | $progress = 0; | | 313 | $progress = 0; |
393 | | | 314 | |
394 | /* | | 315 | /* |
395 | * Checks PHP SAPI version under windows/CLI | | 316 | * Checks PHP SAPI version under windows/CLI |
396 | */ | | 317 | */ |
397 | if( WINDOWS && !WEBINSTALLER && $php_bin=='') { | | 318 | if( WINDOWS && !WEBINSTALLER && $php_bin=='') { |
398 | print " | | 319 | print " |
399 | We do not find any php.exe, please select the php.exe folder (CLI is | | 320 | We do not find any php.exe, please select the php.exe folder (CLI is |
400 | recommanded, usually in c:\php\cli\php.exe) | | 321 | recommanded, usually in c:\php\cli\php.exe) |
401 | "; | | 322 | "; |
402 | $php_bin_set = false; | | 323 | $php_bin_set = false; |
403 | } elseif ( WINDOWS && !WEBINSTALLER && strlen($php_bin) ) { | | 324 | } elseif ( WINDOWS && !WEBINSTALLER && strlen($php_bin) ) { |
404 | $php_bin_sapi = win32DetectPHPSAPI(); | | 325 | $php_bin_sapi = win32DetectPHPSAPI(); |
| @@ -484,114 +405,181 @@ PEAR commandline tool has not been teste | | | @@ -484,114 +405,181 @@ PEAR commandline tool has not been teste |
484 | If you have a CLI (or CGI) php.exe available, we strongly recommand to use it. | | 405 | If you have a CLI (or CGI) php.exe available, we strongly recommand to use it. |
485 | | | 406 | |
486 | "; | | 407 | "; |
487 | } | | 408 | } |
488 | echo "php.exe (sapi: $php_bin_sapi) found.\n\n"; | | 409 | echo "php.exe (sapi: $php_bin_sapi) found.\n\n"; |
489 | $php_bin_set = true; | | 410 | $php_bin_set = true; |
490 | } else { | | 411 | } else { |
491 | echo "**ERROR**: no php.exe found in this folder.\n"; | | 412 | echo "**ERROR**: no php.exe found in this folder.\n"; |
492 | $tmp=''; | | 413 | $tmp=''; |
493 | } | | 414 | } |
494 | } | | 415 | } |
495 | | | 416 | |
496 | if (!empty($tmp) ) { | | 417 | if (!empty($tmp) ) { |
497 | $$var = $tmp; | | 418 | $$var = parse_dirname($tmp); |
498 | } | | 419 | } |
499 | } elseif ($tmp == 'all') { | | 420 | } elseif ($tmp == 'all') { |
500 | foreach ($config_vars as $n => $var) { | | 421 | foreach ($config_vars as $n => $var) { |
501 | $desc = $config_desc[$var]; | | 422 | $desc = $config_desc[$var]; |
502 | $current = $$var; | | 423 | $current = $$var; |
503 | print "$desc [$current] : "; | | 424 | print "$desc [$current] : "; |
504 | $tmp = trim(fgets($tty, 1024)); | | 425 | $tmp = trim(fgets($tty, 1024)); |
505 | if (!empty($tmp)) { | | 426 | if (!empty($tmp)) { |
506 | $$var = $tmp; | | 427 | $$var = $tmp; |
507 | } | | 428 | } |
508 | } | | 429 | } |
509 | } | | 430 | } |
510 | } | | 431 | } |
511 | | | 432 | |
| | | 433 | #### |
| | | 434 | # Installation stuff |
| | | 435 | #### |
| | | 436 | |
| | | 437 | // expand all subvars in the config vars |
512 | foreach ($config_vars as $n => $var) { | | 438 | foreach ($config_vars as $n => $var) { |
513 | for ($m = 1; $m <= count($config_vars); $m++) { | | 439 | for ($m = 1; $m <= count($config_vars); $m++) { |
514 | $var2 = $config_vars[$m]; | | 440 | $var2 = $config_vars[$m]; |
515 | $$var = str_replace('$'.$var2, $$var2, $$var); | | 441 | $$var = str_replace('$'.$var2, $$var2, $$var); |
516 | } | | 442 | } |
| | | 443 | $$var = parse_dirname($$var); |
517 | } | | 444 | } |
518 | | | 445 | |
519 | | | 446 | // temp dir stuff (separate for windows bugs) |
520 | #### | | 447 | if (!empty($temp_dir)) { |
521 | # Temp stuff | | 448 | $_found = temp_dir($temp_dir); |
522 | #### | | 449 | } else { |
523 | if (!empty($temp_dir)) { | | 450 | $_found = temp_dir(); |
524 | $_found = temp_dir($temp_dir); | | 451 | } |
525 | } else { | | 452 | if (!$_found) { |
526 | $_found = temp_dir(); | | 453 | if (!WEBINSTALLER) { |
527 | } | | | |
528 | | | | |
529 | if (!$_found) { | | | |
530 | print " | | 454 | print " |
531 | | | 455 | |
532 | ****************************************************************************** | | 456 | ****************************************************************************** |
533 | FATAL ERROR! We cannot initialize the temp directory. Please be sure to give | | 457 | FATAL ERROR! We cannot initialize the temp directory. Please be sure to give |
534 | full write access to this directory and the install directory. | | 458 | full write access to this directory and the install directory. |
535 | | | 459 | |
536 | "; | | 460 | "; |
| | | 461 | if (!empty($temp_dir)) { |
| | | 462 | print "'$temp_dir' was given."; |
| | | 463 | } |
| | | 464 | exit(); |
537 | | | 465 | |
538 | if (!empty($temp_dir)) { | | 466 | } else { // WEBINSTALLER |
539 | print "'$temp_dir' was given."; | | 467 | if (!is_dir($temp_dir)) { |
| | | 468 | $config_errors['temp_dir'] = 'FATAL ERROR! This directory does not exist and we can not create it. Create the directory manually or make sure we have full permission in its parent directory.'; |
| | | 469 | if (!WINDOWS) { |
| | | 470 | $config_errors['temp_dir'] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 471 | <tt>mkdir '.dirname($temp_dir).' && chmod 0777 '.dirname($temp_dir).'</tt></p>'; |
| | | 472 | } |
| | | 473 | } else { // is_dir(temp_dir) |
| | | 474 | $config_errors['temp_dir'] = 'FATAL ERROR! This directory exists, but we have no write permission in it.'; |
| | | 475 | if (!WINDOWS) { |
| | | 476 | $config_errors['temp_dir'] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 477 | <tt>chmod 0777 '.$temp_dir.'</tt></p>'; |
| | | 478 | } |
| | | 479 | } |
| | | 480 | } |
| | | 481 | } |
| | | 482 | if (@is_dir($ptmp)) { |
| | | 483 | chdir($ptmp); |
540 | } | | 484 | } |
541 | exit(); | | | |
542 | } | | | |
543 | | | | |
544 | $foo = $ptmp; | | | |
545 | | | 485 | |
546 | $ptmp = tempnam($ptmp, 'gope'); | | 486 | // check every dir, existence and permissions |
| | | 487 | foreach ($config_vars as $var) { |
| | | 488 | if (!preg_match('/_dir$/', $var) || $var == 'temp_dir') { |
| | | 489 | continue; |
| | | 490 | } |
547 | | | 491 | |
548 | if (WINDOWS) { | | 492 | $dir = $$var; |
549 | $ptmp = str_replace($foo,'',$ptmp); | | 493 | if (!@is_dir($dir)) { |
550 | $foo = str_replace("\\\\",'/',$foo); | | 494 | if (!mkdir_p($dir)) { |
551 | $s = substr($ptmp,0,1); | | 495 | if (!WEBINSTALLER) { |
552 | if($s == "\\" || $s == '/' ){ | | 496 | $root = WINDOWS ? 'administrator' : 'root'; |
553 | $ptmp = $foo . '/' . substr($ptmp,1); | | 497 | bail("Unable to create {$config_desc[$var]} $dir. |
554 | } else { | | 498 | Run this script as $root or pick another location.\n"); |
555 | $ptmp = $foo . '/' . $ptmp; | | 499 | } else { // WEBINSTALLER |
| | | 500 | $config_errors[$var] = 'ERROR! This directory does not exist and we can not create it. Create the directory manually or make sure we have full permission in its parent directory.'; |
| | | 501 | if (!WINDOWS) { |
| | | 502 | $config_errors[$var] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 503 | <tt>mkdir '.dirname($dir).' && chmod 0777 '.dirname($dir).'</tt></p>'; |
| | | 504 | } |
| | | 505 | } |
| | | 506 | } |
| | | 507 | } |
| | | 508 | if (WEBINSTALLER && @is_dir($dir) && !is_writable($dir)) { |
| | | 509 | $config_errors[$var] = 'ERROR! This directory exists, but we have no write permission in it.'; |
| | | 510 | if (!WINDOWS) { |
| | | 511 | $config_errors[$var] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 512 | <tt>chmod 0777 '.$dir.'</tt></p>'; |
| | | 513 | } |
| | | 514 | } |
556 | } | | 515 | } |
557 | } | | | |
558 | | | | |
559 | rm_rf($ptmp); | | | |
560 | mkdir_p($ptmp, 0700); | | | |
561 | $ok = @chdir($ptmp); | | | |
562 | | | 516 | |
563 | foreach ($config_vars as $var) { | | 517 | // check every file, existence and permissions |
564 | $dir = $$var; | | 518 | foreach ($config_vars as $var) { |
| | | 519 | if (!preg_match('/_file$/', $var)) { |
| | | 520 | continue; |
| | | 521 | } |
565 | | | 522 | |
566 | if (!preg_match('/_dir$/', $var)) { | | 523 | $file = $$var; |
567 | continue; | | 524 | $dir = dirname($file); |
| | | 525 | if (!file_exists($file) && !is_writable($dir)) { |
| | | 526 | if (!WEBINSTALLER) { |
| | | 527 | $root = WINDOWS ? 'administrator' : 'root'; |
| | | 528 | bail("Unable to create {$config_desc[$var]} $file. |
| | | 529 | Run this script as $root or pick another location.\n"); |
| | | 530 | } else { // WEBINSTALLER |
| | | 531 | $config_errors[$var] = 'ERROR! This file does not exist and we can not create it. Make sure we have full permission in its parent directory.'; |
| | | 532 | if (!WINDOWS) { |
| | | 533 | $config_errors[$var] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 534 | <tt>chmod 0777 '.$dir.'</tt></p>'; |
| | | 535 | } |
| | | 536 | } |
| | | 537 | } elseif (WEBINSTALLER && file_exists($file) && !is_writable($file)) { |
| | | 538 | $config_errors[$var] = 'ERROR! This file exists, but we have no write permission on it.'; |
| | | 539 | if (!WINDOWS) { |
| | | 540 | $config_errors[$var] .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 541 | <tt>chmod 0777 '.$file.'</tt></p>'; |
| | | 542 | } |
| | | 543 | } |
568 | } | | 544 | } |
569 | | | 545 | |
570 | if (!@is_dir($dir)) { | | 546 | if (WEBINSTALLER) { |
571 | if (!mkdir_p($dir)) { | | 547 | if ( isset($config_errors) && sizeof($config_errors) ) { |
572 | $root = WINDOWS ? 'administrator' : 'root'; | | 548 | displayHTML('config'); |
573 | bail("Unable to create {$config_desc[$var]} $dir. | | 549 | exit(); |
574 | Run this script as $root or pick another location.\n"); | | 550 | } else { |
| | | 551 | if (isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'] == true && $_GET['step'] == 'install') { |
| | | 552 | $_GET['step'] = 'preinstall'; |
575 | } | | 553 | } |
| | | 554 | if ($_GET['step'] != 'install' && $_GET['step'] != 'install-progress') { |
| | | 555 | displayHTML($_GET['step']); |
| | | 556 | exit; |
| | | 557 | } |
| | | 558 | if ($_GET['step'] == 'install-progress') { |
| | | 559 | displayHTMLHeader(); |
| | | 560 | echo "Starting installation ...<br/>"; |
| | | 561 | } |
| | | 562 | ob_start(); |
576 | } | | 563 | } |
577 | } | | 564 | } |
578 | | | 565 | |
579 | if (!WEBINSTALLER) { | | 566 | if (!WEBINSTALLER) { |
580 | $msg = "The following PEAR packages are bundled with PHP: " . | | 567 | $msg = "The following PEAR packages are bundled with PHP: " . |
581 | implode(', ', $pfc_packages); | | 568 | implode(', ', array_keys($pfc_packages)); |
582 | print "\n" . wordwrap($msg, 75) . ".\n"; | | 569 | print "\n" . wordwrap($msg, 75) . ".\n"; |
583 | print "Would you like to install these as well? [Y/n] : "; | | 570 | print "Would you like to install these as well? [Y/n] : "; |
584 | $install_pfc = !stristr(fgets($tty, 1024), "n"); | | 571 | $install_pfc = !stristr(fgets($tty, 1024), "n"); |
| | | 572 | $install_optional_packages = array(); |
585 | print "\n"; | | 573 | print "\n"; |
586 | } | | 574 | } |
587 | | | 575 | |
588 | #### | | 576 | #### |
589 | # Download | | 577 | # Download |
590 | #### | | 578 | #### |
591 | | | 579 | |
592 | if (function_exists('set_include_path')) { | | 580 | if (function_exists('set_include_path')) { |
593 | set_include_path($ptmp); | | 581 | set_include_path($ptmp); |
594 | } else { | | 582 | } else { |
595 | ini_set('include_path', $ptmp); | | 583 | ini_set('include_path', $ptmp); |
596 | } | | 584 | } |
597 | | | 585 | |
| @@ -611,217 +599,238 @@ if (!extension_loaded('zlib')) { | | | @@ -611,217 +599,238 @@ if (!extension_loaded('zlib')) { |
611 | $have_gzip = null; | | 599 | $have_gzip = null; |
612 | } else { | | 600 | } else { |
613 | $urltemplate = 'http://pear.php.net/get/%s'; | | 601 | $urltemplate = 'http://pear.php.net/get/%s'; |
614 | $have_gzip = true; | | 602 | $have_gzip = true; |
615 | } | | 603 | } |
616 | | | 604 | |
617 | print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n"; | | 605 | print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n"; |
618 | | | 606 | |
619 | if (!$have_gzip) { | | 607 | if (!$have_gzip) { |
620 | print "Downloading uncompressed packages\n"; | | 608 | print "Downloading uncompressed packages\n"; |
621 | }; | | 609 | }; |
622 | | | 610 | |
623 | if ($install_pfc) { | | 611 | if ($install_pfc) { |
624 | $to_install = array_merge($installer_packages, $pfc_packages); | | 612 | $to_install = array_merge($installer_packages, array_keys($pfc_packages)); |
625 | } else { | | 613 | } else { |
626 | $to_install = $installer_packages; | | 614 | $to_install = $installer_packages; |
627 | } | | | |
628 | | | | |
629 | displayHTMLProgress($progress = 5); | | | |
630 | | | 615 | |
631 | if (file_exists(dirname(__FILE__).'/go-pear-bundle') || is_dir(dirname(__FILE__).'/go-pear-bundle')) { | | 616 | // webinstaller allows to choose pfc packages individually |
632 | $dh = @opendir(dirname(__FILE__).'/go-pear-bundle'); | | 617 | foreach ($pfc_packages as $pkg => $desc) { |
633 | } else { | | 618 | if (in_array($pkg, $install_optional_packages)) { |
634 | $dh = false; | | 619 | array_push($to_install, $pkg); |
| | | 620 | } |
| | | 621 | } |
635 | } | | 622 | } |
636 | | | 623 | |
| | | 624 | // gopear_bundle usage |
637 | $local_dir = array(); | | 625 | $local_dir = array(); |
638 | if ($dh) { | | 626 | if (file_exists($gopear_bundle_dir) || is_dir($gopear_bundle_dir)) { |
| | | 627 | $dh = @opendir($gopear_bundle_dir); |
| | | 628 | |
639 | while($file = @readdir($dh)) { | | 629 | while($file = @readdir($dh)) { |
640 | if ($file == '.' || $file == '..' || !is_file(dirname(__FILE__).'/go-pear-bundle/'.$file)) { | | 630 | if ($file == '.' || $file == '..' || !is_file($gopear_bundle_dir.'/'.$file)) { |
641 | continue; | | 631 | continue; |
642 | } | | 632 | } |
643 | $_pos = strpos($file, '-'); | | 633 | $_pos = strpos($file, '-'); |
644 | if ($_pos === false) { | | 634 | if ($_pos === false) { |
645 | $local_dir[$file] = $file; | | 635 | $local_dir[$file] = $file; |
646 | } else { | | 636 | } else { |
647 | $local_dir[substr($file, 0, $_pos)] = $file; | | 637 | $local_dir[substr($file, 0, $_pos)] = $file; |
648 | } | | 638 | } |
649 | } | | 639 | } |
| | | 640 | closedir($dh); |
| | | 641 | unset($dh, $file, $_pos); |
650 | } | | 642 | } |
651 | | | 643 | |
652 | foreach ($installer_packages as $pkg) { | | 644 | print "\n".'Bootstrapping Installer...................'."\n"; |
653 | $pkg_basename = substr($pkg, 0, strpos($pkg, '-')); | | 645 | displayHTMLProgress($progress = 5); |
654 | if (isset($local_dir[$pkg_basename])) { | | | |
655 | echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.'); | | | |
656 | copy(dirname(__FILE__) . '/go-pear-bundle/' . $local_dir[$pkg_basename], $local_dir[$pkg_basename]); | | | |
657 | $tarball[$pkg_basename] = $local_dir[$pkg_basename]; | | | |
658 | echo "ok\n"; | | | |
659 | displayHTMLProgress($progress += round(65 / count($to_install))); | | | |
660 | continue; | | | |
661 | } | | | |
662 | | | | |
663 | $msg = str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.'); | | | |
664 | print $msg; | | | |
665 | $url = sprintf($urltemplate, $pkg); | | | |
666 | | | | |
667 | $pkg = str_replace('-stable', '', $pkg); | | | |
668 | | | | |
669 | $tarball[$pkg] = download_url($url, null, $http_proxy); | | | |
670 | print "ok\n"; | | | |
671 | displayHTMLProgress($progress += round(65 / count($to_install))); | | | |
672 | } | | | |
673 | | | | |
674 | print 'Bootstrapping: PEAR...................'; | | | |
675 | if (in_array('PEAR.php', $local_dir)) { | | | |
676 | copy(dirname(__FILE__).'/go-pear-bundle/PEAR.php', 'PEAR.php'); | | | |
677 | echo "(local) "; | | | |
678 | } else { | | | |
679 | $url = 'http://cvs.php.net/viewcvs.cgi/pear-core/PEAR.php?view=co&pathrev=PEAR_1_4'; | | | |
680 | echo "(remote) "; | | | |
681 | download_url($url, 'PEAR.php', $http_proxy); | | | |
682 | } | | | |
683 | | | | |
684 | include_once 'PEAR.php'; | | | |
685 | print "ok\n"; | | | |
686 | | | | |
687 | print 'Bootstrapping: Archive_Tar............'; | | | |
688 | $r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_', substr(substr($tarball['Archive_Tar'], 12), 0, -4)); | | | |
689 | | | 646 | |
690 | /* force to a known revision */ | | 647 | // Bootstrap needed ? |
691 | $url = "http://cvs.php.net/viewcvs.cgi/pear/Archive_Tar/Archive/Tar.php?view=co&pathrev=RELEASE_1_3_2"; | | 648 | $nobootstrap = false; |
692 | mkdir('Archive', 0700); | | 649 | if (is_dir($php_dir)) { |
693 | | | 650 | $nobootstrap = true; |
694 | if (in_array('Tar.php', $local_dir)) { | | 651 | foreach ($bootstrap_files as $file => $url) { |
695 | copy(dirname(__FILE__).'/go-pear-bundle/Tar.php', 'Archive/Tar.php'); | | 652 | $nobootstrap &= is_file($php_dir.'/'.$file); |
696 | echo "(local) "; | | 653 | } |
697 | } else { | | | |
698 | download_url($url, 'Archive/Tar.php', $http_proxy); | | | |
699 | echo "(remote) "; | | | |
700 | } | | 654 | } |
701 | print "ok\n"; | | | |
702 | | | 655 | |
703 | print 'Bootstrapping: Console_Getopt.........'; | | 656 | if ($nobootstrap) { |
704 | $r = 'RELEASE_' . ereg_replace('[^A-Za-z0-9]', '_', substr(substr($tarball['Console_Getopt'], 15), 0, -4)); | | 657 | print('Using previously install ... '); |
705 | $url = "http://cvs.php.net/viewcvs.cgi/pear-core/Console/Getopt.php?view=co&pathrev=PEAR_1_4"; | | 658 | if (function_exists('set_include_path')) { |
706 | mkdir('Console', 0700); | | 659 | set_include_path($php_dir); |
707 | if (in_array('Getopt.php', $local_dir)) { | | 660 | } else { |
708 | copy(dirname(__FILE__).'/go-pear-bundle/Getopt.php', 'Console/Getopt.php'); | | 661 | ini_set('include_path', $php_dir); |
709 | echo "(local) "; | | 662 | } |
| | | 663 | include_once 'PEAR.php'; |
| | | 664 | print "ok\n"; |
710 | } else { | | 665 | } else { |
711 | download_url($url, 'Console/Getopt.php', $http_proxy); | | 666 | foreach($bootstrap_files as $name => $url) { |
712 | echo "(remote) "; | | 667 | $file = basename($name); |
713 | } | | 668 | $dir = dirname($name); |
714 | print "ok\n"; | | 669 | |
715 | | | 670 | print 'Bootstrapping '.$name.'............'; |
716 | if ($install_pfc) { | | 671 | displayHTMLProgress($progress += round(14 / count($bootstrap_files))); |
717 | foreach ($pfc_packages as $pkg) { | | 672 | if ($dir != '' && $dir != '.') { |
718 | foreach($local_dir as $file) { | | 673 | mkdir($dir, 0700); |
719 | if (substr($file, 0, strlen($pkg)) == $pkg) { | | 674 | } |
720 | echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.'); | | | |
721 | copy(dirname(__FILE__).'/go-pear-bundle/'.$file, $file); | | | |
722 | $tarball[$pkg] = $file; | | | |
723 | echo "ok\n"; | | | |
724 | displayHTMLProgress($progress += round(65 / count($to_install))); | | | |
725 | continue 2; | | | |
726 | }; | | | |
727 | }; | | | |
728 | | | 675 | |
729 | $msg = str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.'); | | 676 | if (in_array($file, $local_dir)) { |
730 | print $msg; | | 677 | copy($gopear_bundle_dir.'/'.$file, $name); |
731 | $url = sprintf($urltemplate, $pkg); | | 678 | echo '(local) '; |
732 | $tarball[$pkg] = download_url($url, null, $http_proxy); | | 679 | } else { |
| | | 680 | download_url($url, $name, $http_proxy); |
| | | 681 | echo '(remote) '; |
| | | 682 | } |
| | | 683 | include_once $name; |
733 | print "ok\n"; | | 684 | print "ok\n"; |
734 | displayHTMLProgress($progress += round(65 / count($to_install))); | | | |
735 | } | | 685 | } |
736 | } | | 686 | } |
737 | | | 687 | unset($nobootstrap, $file, $url, $name, $dir); |
738 | displayHTMLProgress($progress = 70); | | | |
739 | | | 688 | |
740 | PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n"); | | 689 | PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n"); |
741 | print 'Extracting installer..................'; | | 690 | print "\n".'Extracting installer..................'."\n"; |
742 | | | 691 | displayHTMLProgress($progress = 20); |
743 | $dot = strrpos($tarball['Structures_Graph'], '.'); | | | |
744 | $pkg = substr($tarball['Structures_Graph'], 0, $dot); | | | |
745 | $ext = substr($tarball['Structures_Graph'], $dot + 1); | | | |
746 | | | 692 | |
747 | include_once 'Archive/Tar.php'; | | 693 | // Extract needed ? |
748 | | | 694 | $noextract = false; |
749 | $tar = &new Archive_Tar($tarball['Structures_Graph'], $have_gzip); | | 695 | if (is_dir($php_dir)) { |
750 | if (!$tar->extractModify($ptmp, $pkg)) { | | 696 | $noextract = @include_once 'PEAR/Registry.php'; |
751 | bail("failed!\n"); | | 697 | |
| | | 698 | if ($noextract) { |
| | | 699 | $registry = new PEAR_Registry($php_dir); |
| | | 700 | foreach ($bootstrap_pkgs as $pkg) { |
| | | 701 | $noextract &= $registry->packageExists($pkg); |
| | | 702 | } |
| | | 703 | } |
752 | } | | 704 | } |
753 | | | 705 | |
754 | $dot = strrpos($tarball['PEAR'], '.'); | | 706 | if ($noextract) { |
755 | $pkg = substr($tarball['PEAR'], 0, $dot); | | 707 | print('Using previously installed installer ... '); |
756 | $ext = substr($tarball['PEAR'], $dot + 1); | | 708 | print "ok\n"; |
757 | | | 709 | } else { |
758 | $tar = &new Archive_Tar($tarball['PEAR'], $have_gzip); | | 710 | $bootstrap_pkgs_tarballs = array(); |
759 | if (!$tar->extractModify($ptmp, $pkg)) { | | 711 | foreach ($bootstrap_pkgs as $pkg) { |
760 | bail("failed!\n"); | | 712 | $tarball = null; |
| | | 713 | if (isset($local_dir[$pkg])) { |
| | | 714 | echo str_pad("Using local package: $pkg", max(38,21+strlen($pkg)+4), '.'); |
| | | 715 | copy($gopear_bundle_dir.'/'.$local_dir[$pkg], $local_dir[$pkg]); |
| | | 716 | $tarball = $local_dir[$pkg]; |
| | | 717 | } else { |
| | | 718 | print str_pad("Downloading package: $pkg", max(38,21+strlen($pkg)+4), '.'); |
| | | 719 | $url = sprintf($urltemplate, $pkg); |
| | | 720 | $pkg = str_replace('-stable', '', $pkg); |
| | | 721 | $tarball = download_url($url, null, $http_proxy); |
| | | 722 | } |
| | | 723 | displayHTMLProgress($progress += round(19 / count($bootstrap_pkgs))); |
| | | 724 | |
| | | 725 | $fullpkg = substr($tarball, 0, strrpos($tarball, '.')); |
| | | 726 | $tar = &new Archive_Tar($tarball, $have_gzip); |
| | | 727 | if (!$tar->extractModify($ptmp, $fullpkg)) { |
| | | 728 | bail("Extraction for $fullpkg failed!\n"); |
| | | 729 | } |
| | | 730 | $bootstrap_pkgs_tarballs[$pkg] = $tarball; |
| | | 731 | print "ok\n"; |
| | | 732 | } |
761 | } | | 733 | } |
762 | print "ok\n"; | | 734 | unset($noextract, $registry, $pkg, $tarball, $url, $fullpkg, $tar); |
763 | | | 735 | |
764 | $tarball['PEAR'] = 'package.xml'; // :-) | | 736 | |
| | | 737 | print "\n".'Preparing installer..................'."\n"; |
| | | 738 | displayHTMLProgress($progress = 40); |
765 | | | 739 | |
766 | // Default for sig_bin | | 740 | // Default for sig_bin |
767 | putenv('PHP_PEAR_SIG_BIN=""'); | | 741 | putenv('PHP_PEAR_SIG_BIN=""'); |
768 | // Default for sig_keydir | | 742 | // Default for sig_keydir |
769 | putenv('PHP_PEAR_SIG_KEYDIR=""'); | | 743 | putenv('PHP_PEAR_SIG_KEYDIR=""'); |
770 | putenv('PHP_PEAR_DOWNLOAD_DIR=' . $temp_dir . '/download'); | | 744 | putenv('PHP_PEAR_DOWNLOAD_DIR=' . $temp_dir . '/download'); |
771 | putenv('PHP_PEAR_TEMP_DIR=' . $temp_dir); | | 745 | putenv('PHP_PEAR_TEMP_DIR=' . $temp_dir); |
772 | | | 746 | |
773 | include_once "PEAR.php"; | | | |
774 | include_once "PEAR/Config.php"; | | 747 | include_once "PEAR/Config.php"; |
775 | include_once "PEAR/Command.php"; | | 748 | include_once "PEAR/Command.php"; |
776 | include_once "PEAR/Registry.php"; | | 749 | include_once "PEAR/Registry.php"; |
777 | | | 750 | |
778 | if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') { | | 751 | if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') { |
779 | $config = &PEAR_Config::singleton($prefix."/pear.conf", ''); | | 752 | $config = &PEAR_Config::singleton($prefix."/pear.conf", ''); |
780 | } else { | | 753 | } else { |
781 | $config = &PEAR_Config::singleton(); | | 754 | $config = &PEAR_Config::singleton(); |
782 | } | | 755 | } |
783 | | | 756 | |
784 | | | 757 | |
785 | $config->set('preferred_state', 'stable'); | | 758 | $config->set('preferred_state', 'stable'); |
786 | foreach ($config_vars as $var) { | | 759 | foreach ($config_vars as $var) { |
787 | $config->set($var, $$var); | | 760 | if (isset($$var) && $$var != '') { |
| | | 761 | $config->set($var, $$var); |
| | | 762 | } |
788 | } | | 763 | } |
789 | $config->set('download_dir', $temp_dir . '/download'); | | 764 | $config->set('download_dir', $temp_dir . '/download'); |
790 | $config->set('temp_dir', $temp_dir); | | 765 | $config->set('temp_dir', $temp_dir); |
| | | 766 | $config->set('http_proxy', $http_proxy); |
791 | $config->store(); | | 767 | $config->store(); |
792 | | | 768 | |
793 | $registry = new PEAR_Registry($php_dir); | | 769 | $registry = new PEAR_Registry($php_dir); |
794 | PEAR_Command::setFrontendType('CLI'); | | 770 | PEAR_Command::setFrontendType('CLI'); |
795 | $install = &PEAR_Command::factory('install', $config); | | | |
796 | | | 771 | |
797 | $install_options = array( | | 772 | PEAR::staticPushErrorHandling(PEAR_ERROR_DIE); //fail silently |
798 | 'nodeps' => true, | | 773 | $ch_cmd = &PEAR_Command::factory('update-channels', $config); |
799 | 'force' => true, | | 774 | $ch_cmd->run('update-channels', $options, array()); |
800 | ); | | 775 | PEAR::staticPopErrorHandling(); // reset error handling |
| | | 776 | unset($ch_cmd); |
801 | | | 777 | |
802 | foreach ($tarball as $pkg => $src) { | | | |
803 | $options = $install_options; | | | |
804 | if ($registry->packageExists($pkg)) { | | | |
805 | $options['upgrade'] = true; | | | |
806 | } | | | |
807 | | | 778 | |
808 | $install->run('install', $options, array($src)); | | 779 | print "\n".'Installing selected packages..................'."\n"; |
| | | 780 | displayHTMLProgress($progress = 45); |
809 | | | 781 | |
810 | displayHTMLProgress($progress += round(29 / count($tarball))); | | 782 | $install = &PEAR_Command::factory('install', $config); |
811 | } | | 783 | foreach ($to_install as $pkg) { |
| | | 784 | $pkg_basename = substr($pkg, 0, strpos($pkg, '-')); |
812 | | | 785 | |
| | | 786 | if (in_array($pkg, $installer_packages)) { |
| | | 787 | $options = array('nodeps' => true); |
| | | 788 | } else { |
| | | 789 | $options = array('onlyreqdeps' => true); |
| | | 790 | } |
| | | 791 | if ($registry->packageExists($pkg) || $registry->packageExists($pkg_basename)) { |
| | | 792 | print(str_pad("Package: $pkg", max(50,9+strlen($pkg)+4), '.').' already installed ... ok'."\n"); |
| | | 793 | displayHTMLProgress($progress += round(50 / count($to_install))); |
| | | 794 | continue; |
| | | 795 | } |
| | | 796 | |
| | | 797 | $pkg_basename = substr($pkg, 0, strpos($pkg, '-')); |
| | | 798 | if (in_array($pkg_basename, $bootstrap_pkgs)) { |
| | | 799 | print(str_pad("Installing bootstrap package: $pkg_basename", max(50,30+strlen($pkg_basename)+4), '.')."..."); |
| | | 800 | displayHTMLProgress($progress += round(25 / count($to_install))); |
| | | 801 | $install->run('install', $options, array($bootstrap_pkgs_tarballs[$pkg_basename])); |
| | | 802 | } elseif (isset($local_dir[$pkg_basename])) { |
| | | 803 | print(str_pad("Installing local package: $pkg", max(50,26+strlen($pkg)+4), '.')."..."); |
| | | 804 | displayHTMLProgress($progress += round(25 / count($to_install))); |
| | | 805 | $install->run('install', $options, array($gopear_bundle_dir.'/'.$local_dir[$pkg_basename])); |
| | | 806 | } else { // no local copy |
| | | 807 | print(str_pad("Downloading and installing package: $pkg", max(50,36+strlen($pkg)+4), '.')."..."); |
| | | 808 | displayHTMLProgress($progress += round(25 / count($to_install))); |
| | | 809 | $install->run('install', $options, array($pkg)); |
| | | 810 | } |
| | | 811 | displayHTMLProgress($progress += round(25 / count($to_install))); |
| | | 812 | } |
| | | 813 | unset($pkg, $pkg_basename, $options, $bootstrap_pkgs_tarballs); |
| | | 814 | |
| | | 815 | /* TODO: Memory exhaustion in webinstaller : / (8Mb) |
| | | 816 | print "\n".'Making sure every package is at the latest version........'; |
| | | 817 | $install->run('upgrade-all', array('soft' => true), array()); |
| | | 818 | print "ok\n"; |
| | | 819 | */ |
| | | 820 | unset($config, $registry, $install); |
813 | displayHTMLProgress($progress = 99); | | 821 | displayHTMLProgress($progress = 99); |
814 | | | 822 | |
| | | 823 | |
815 | // Base installation finished | | 824 | // Base installation finished |
816 | | | 825 | |
817 | ini_restore("include_path"); | | 826 | ini_restore("include_path"); |
818 | | | 827 | |
819 | if (!WEBINSTALLER) { | | 828 | if (!WEBINSTALLER) { |
820 | $sep = WINDOWS ? ';' : ':'; | | 829 | $sep = WINDOWS ? ';' : ':'; |
821 | $include_path = explode($sep, ini_get('include_path')); | | 830 | $include_path = explode($sep, ini_get('include_path')); |
822 | if (WINDOWS) { | | 831 | if (WINDOWS) { |
823 | $found = false; | | 832 | $found = false; |
824 | $t = strtolower($php_dir); | | 833 | $t = strtolower($php_dir); |
825 | foreach($include_path as $path) { | | 834 | foreach($include_path as $path) { |
826 | if ($t==strtolower($path)) { | | 835 | if ($t==strtolower($path)) { |
827 | $found = true; | | 836 | $found = true; |
| @@ -900,44 +909,45 @@ Currently used php.ini (guess) : $php_in | | | @@ -900,44 +909,45 @@ Currently used php.ini (guess) : $php_in |
900 | print " | | 909 | print " |
901 | ** The 'pear' command is not currently in your PATH, so you need to | | 910 | ** The 'pear' command is not currently in your PATH, so you need to |
902 | ** use '$pear_cmd' until you have added | | 911 | ** use '$pear_cmd' until you have added |
903 | ** '$bin_dir' to your PATH environment variable. | | 912 | ** '$bin_dir' to your PATH environment variable. |
904 | | | 913 | |
905 | "; | | 914 | "; |
906 | | | 915 | |
907 | print "Run it without parameters to see the available actions, try 'pear list' | | 916 | print "Run it without parameters to see the available actions, try 'pear list' |
908 | to see what packages are installed, or 'pear help' for help. | | 917 | to see what packages are installed, or 'pear help' for help. |
909 | | | 918 | |
910 | For more information about PEAR, see: | | 919 | For more information about PEAR, see: |
911 | | | 920 | |
912 | http://pear.php.net/faq.php | | 921 | http://pear.php.net/faq.php |
913 | http://cvs.php.net/co.php/pearweb/doc/pear_package_manager.txt?p=1 | | | |
914 | http://pear.php.net/manual/ | | 922 | http://pear.php.net/manual/ |
915 | | | 923 | |
916 | Thanks for using go-pear! | | 924 | Thanks for using go-pear! |
917 | | | 925 | |
918 | "; | | 926 | "; |
919 | } | | 927 | } |
920 | } | | 928 | } |
921 | | | 929 | |
922 | if (WEBINSTALLER) { | | 930 | if (WEBINSTALLER) { |
923 | print "Writing WebFrontend file ... "; | | 931 | print "\n".'Writing WebFrontend file ... '; |
924 | @unlink($webfrontend_file); //Delete old one | | 932 | @unlink($webfrontend_file); //Delete old one |
925 | copy ( $doc_dir.DIRECTORY_SEPARATOR. | | 933 | copy ( $doc_dir.DIRECTORY_SEPARATOR. |
926 | 'PEAR_Frontend_Web'.DIRECTORY_SEPARATOR. | | 934 | 'PEAR_Frontend_Web'.DIRECTORY_SEPARATOR. |
927 | 'docs'.DIRECTORY_SEPARATOR. | | 935 | 'docs'.DIRECTORY_SEPARATOR. |
928 | 'example.php', | | 936 | 'index.php.txt', |
929 | $webfrontend_file | | 937 | $webfrontend_file |
930 | ); | | 938 | ); |
| | | 939 | print "ok\n"; |
| | | 940 | |
931 | if ($_GET['step'] == 'install-progress') { | | 941 | if ($_GET['step'] == 'install-progress') { |
932 | displayHTMLProgress($progress = 100); | | 942 | displayHTMLProgress($progress = 100); |
933 | ob_end_clean(); | | 943 | ob_end_clean(); |
934 | displayHTMLInstallationSummary(); | | 944 | displayHTMLInstallationSummary(); |
935 | displayHTMLFooter(); | | 945 | displayHTMLFooter(); |
936 | } else { | | 946 | } else { |
937 | $out = ob_get_contents(); | | 947 | $out = ob_get_contents(); |
938 | | | 948 | |
939 | $out = explode("\n", $out); | | 949 | $out = explode("\n", $out); |
940 | foreach($out as $line => $value) { | | 950 | foreach($out as $line => $value) { |
941 | if (preg_match('/ok$/', $value)) { | | 951 | if (preg_match('/ok$/', $value)) { |
942 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); | | 952 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); |
943 | }; | | 953 | }; |
| @@ -962,51 +972,90 @@ if (WEBINSTALLER) { | | | @@ -962,51 +972,90 @@ if (WEBINSTALLER) { |
962 | exit; | | 972 | exit; |
963 | } | | 973 | } |
964 | | | 974 | |
965 | // Little hack, this will be fixed in PEAR later | | 975 | // Little hack, this will be fixed in PEAR later |
966 | if ( WINDOWS ) { | | 976 | if ( WINDOWS ) { |
967 | clearstatcache(); | | 977 | clearstatcache(); |
968 | @unlink($bin_dir.DIRECTORY_SEPARATOR.'.tmppear'); | | 978 | @unlink($bin_dir.DIRECTORY_SEPARATOR.'.tmppear'); |
969 | } | | 979 | } |
970 | | | 980 | |
971 | if (WINDOWS && !WEBINSTALLER) { | | 981 | if (WINDOWS && !WEBINSTALLER) { |
972 | win32CreateRegEnv(); | | 982 | win32CreateRegEnv(); |
973 | } | | 983 | } |
974 | // Set of functions following | | 984 | // Set of functions following |
| | | 985 | /** |
| | | 986 | * Parse the given dirname |
| | | 987 | * eg. expands '~' etc |
| | | 988 | * |
| | | 989 | * @param string $dir directory, from input |
| | | 990 | * @return string parsed directory |
| | | 991 | */ |
| | | 992 | function parse_dirname($dir) |
| | | 993 | { |
| | | 994 | if (!isset($_ENV['HOME'])) { |
| | | 995 | if (strpos($dir, '~') === 0) { |
| | | 996 | if (WEBINSTALLER) { |
| | | 997 | die('<p><em>Can\'t use the \'~\' symbol for homedir substitution, write the directory out in full.</em></p>'); |
| | | 998 | } else { |
| | | 999 | die('Can\'t use the \'~\' symbol for homedir substitution, write the directory out in full.'); |
| | | 1000 | } |
| | | 1001 | } |
| | | 1002 | return $dir; |
| | | 1003 | } |
| | | 1004 | |
| | | 1005 | $home_root = $_ENV['HOME']; |
| | | 1006 | // first strip last slash, if available |
| | | 1007 | if (substr($home_root, -1) == DIRECTORY_SEPARATOR) { |
| | | 1008 | $home_root = substr($home_root, 0, -1); |
| | | 1009 | } |
| | | 1010 | if (strpos($dir, '~/') === 0) { |
| | | 1011 | // eg ~/ = /home/tias/ |
| | | 1012 | $dir = substr_replace($dir, $home_root, 0, 1); |
| | | 1013 | } elseif (strpos($dir, '~') === 0) { |
| | | 1014 | // eg ~tias/ = /home/tias/ |
| | | 1015 | // then delete user-dir |
| | | 1016 | $home_root = dirname($home_root) . DIRECTORY_SEPARATOR; |
| | | 1017 | $dir = substr_replace($dir, $home_root, 0, 1); |
| | | 1018 | } |
| | | 1019 | |
| | | 1020 | return $dir; |
| | | 1021 | } |
| | | 1022 | |
975 | | | 1023 | |
976 | // {{{ download_url() | | 1024 | // {{{ download_url() |
977 | | | 1025 | |
978 | function download_url($url, $destfile = null, $proxy = null) | | 1026 | function download_url($url, $destfile = null, $proxy = null) |
979 | { | | 1027 | { |
980 | $use_suggested_filename = ($destfile === null); | | 1028 | $use_suggested_filename = ($destfile === null); |
981 | if ($use_suggested_filename) { | | 1029 | if ($use_suggested_filename) { |
982 | $destfile = basename($url); | | 1030 | $destfile = basename($url); |
983 | } | | 1031 | } |
984 | $tmp = parse_url($url); | | 1032 | $tmp = parse_url($url); |
985 | if (empty($tmp['port'])) { | | 1033 | if (empty($tmp['port'])) { |
986 | $tmp['port'] = 80; | | 1034 | $tmp['port'] = 80; |
987 | } | | 1035 | } |
988 | if (empty($proxy)) { | | 1036 | if (empty($proxy)) { |
989 | $fp = fsockopen($tmp['host'], $tmp['port'], $errno, $errstr); | | 1037 | $fp = fsockopen($tmp['host'], $tmp['port'], $errno, $errstr); |
990 | //print "\nconnecting to $tmp[host]:$tmp[port]\n"; | | 1038 | //print "\nconnecting to $tmp[host]:$tmp[port]\n"; |
991 | } else { | | 1039 | } else { |
992 | $tmp_proxy = parse_url($proxy); | | 1040 | $tmp_proxy = parse_url($proxy); |
993 | $phost = $tmp_proxy['host']; | | 1041 | $phost = $tmp_proxy['host']; |
994 | $pport = $tmp_proxy['port']; | | 1042 | $pport = $tmp_proxy['port']; |
995 | $fp = fsockopen($phost, $pport, $errno, $errstr); | | 1043 | $fp = fsockopen($phost, $pport, $errno, $errstr); |
996 | //print "\nconnecting to $phost:$pport\n"; | | 1044 | //print "\nconnecting to $phost:$pport\n"; |
997 | } | | 1045 | } |
998 | if (!$fp) { | | 1046 | if (!$fp) { |
999 | bail("download of $url failed: $errstr ($errno)\n"); | | 1047 | bail("download of $url failed: $errstr ($errno)\n"); |
| | | 1048 | // If valid URL but error, no CURL extentions installed |
1000 | } | | 1049 | } |
1001 | if (empty($proxy)) { | | 1050 | if (empty($proxy)) { |
1002 | $path = $tmp['path']; | | 1051 | $path = $tmp['path']; |
1003 | } else { | | 1052 | } else { |
1004 | $path = "http://$tmp[host]:$tmp[port]$tmp[path]"; | | 1053 | $path = "http://$tmp[host]:$tmp[port]$tmp[path]"; |
1005 | } | | 1054 | } |
1006 | if (isset($tmp['query'])) { | | 1055 | if (isset($tmp['query'])) { |
1007 | $path .= "?$tmp[query]"; | | 1056 | $path .= "?$tmp[query]"; |
1008 | } | | 1057 | } |
1009 | if (isset($tmp['fragment'])) { | | 1058 | if (isset($tmp['fragment'])) { |
1010 | $path .= "#$tmp[fragment]"; | | 1059 | $path .= "#$tmp[fragment]"; |
1011 | } | | 1060 | } |
1012 | $request = "GET $path HTTP/1.0\r\nHost: $tmp[host]:$tmp[port]\r\n". | | 1061 | $request = "GET $path HTTP/1.0\r\nHost: $tmp[host]:$tmp[port]\r\n". |
| @@ -1025,45 +1074,46 @@ function download_url($url, $destfile = | | | @@ -1025,45 +1074,46 @@ function download_url($url, $destfile = |
1025 | if (trim($line) == '') { | | 1074 | if (trim($line) == '') { |
1026 | break; | | 1075 | break; |
1027 | } | | 1076 | } |
1028 | if (preg_match('/^Content-Length: (.*)$/i', $line, $matches)) { | | 1077 | if (preg_match('/^Content-Length: (.*)$/i', $line, $matches)) { |
1029 | $content_length = trim($matches[1]); | | 1078 | $content_length = trim($matches[1]); |
1030 | } | | 1079 | } |
1031 | if ($use_suggested_filename && !strncasecmp($line, $cdh, $cdhl)) { | | 1080 | if ($use_suggested_filename && !strncasecmp($line, $cdh, $cdhl)) { |
1032 | if (eregi('filename="([^"]+)"', $line, $matches)) { | | 1081 | if (eregi('filename="([^"]+)"', $line, $matches)) { |
1033 | $destfile = basename($matches[1]); | | 1082 | $destfile = basename($matches[1]); |
1034 | } | | 1083 | } |
1035 | } | | 1084 | } |
1036 | } | | 1085 | } |
1037 | | | 1086 | |
1038 | if ($content_length) { | | 1087 | displayHTMLSetDownload($destfile); |
1039 | displayHTMLSetDownload($destfile); | | | |
1040 | }; | | | |
1041 | $wp = fopen($destfile, "wb"); | | 1088 | $wp = fopen($destfile, "wb"); |
1042 | if (!$wp) { | | 1089 | if (!$wp) { |
1043 | bail("could not open $destfile for writing\n"); | | 1090 | bail("could not open $destfile for writing\n"); |
1044 | } | | 1091 | } |
1045 | $bytes_read = 0; | | 1092 | $bytes_read = 0; |
1046 | $progress = 0; | | 1093 | $progress = 0; |
1047 | while ($data = fread($fp, 2048)) { | | 1094 | while ($data = fread($fp, 2048)) { |
1048 | fwrite($wp, $data); | | 1095 | fwrite($wp, $data); |
1049 | $bytes_read += strlen($data); | | 1096 | $bytes_read += strlen($data); |
1050 | if ($content_length != 0 && floor($bytes_read * 10 / $content_length) != $progress) { | | 1097 | if ($content_length != 0 && floor($bytes_read * 10 / $content_length) != $progress) { |
1051 | $progress = floor($bytes_read * 10 / $content_length); | | 1098 | $progress = floor($bytes_read * 10 / $content_length); |
1052 | displayHTMLDownloadProgress($progress * 10); | | 1099 | displayHTMLDownloadProgress($progress * 10); |
1053 | }; | | 1100 | }; |
1054 | } | | 1101 | } |
| | | 1102 | displayHTMLDownloadProgress(100); |
1055 | fclose($fp); | | 1103 | fclose($fp); |
1056 | fclose($wp); | | 1104 | fclose($wp); |
| | | 1105 | |
| | | 1106 | displayHTMLSetDownload(''); |
1057 | return $destfile; | | 1107 | return $destfile; |
1058 | } | | 1108 | } |
1059 | | | 1109 | |
1060 | // }}} | | 1110 | // }}} |
1061 | // {{{ which() | | 1111 | // {{{ which() |
1062 | | | 1112 | |
1063 | function which($program, $dont_search_in = false) | | 1113 | function which($program, $dont_search_in = false) |
1064 | { | | 1114 | { |
1065 | if (WINDOWS) { | | 1115 | if (WINDOWS) { |
1066 | if ($_path=my_env('Path')) { | | 1116 | if ($_path=my_env('Path')) { |
1067 | $dirs = explode(';', $_path); | | 1117 | $dirs = explode(';', $_path); |
1068 | } else { | | 1118 | } else { |
1069 | $dirs = explode(';', my_env('PATH')); | | 1119 | $dirs = explode(';', my_env('PATH')); |
| @@ -1145,29 +1195,30 @@ function bail($msg = '') | | | @@ -1145,29 +1195,30 @@ function bail($msg = '') |
1145 | function mkdir_p($dir, $mode = 0777) | | 1195 | function mkdir_p($dir, $mode = 0777) |
1146 | { | | 1196 | { |
1147 | if (@is_dir($dir)) { | | 1197 | if (@is_dir($dir)) { |
1148 | return true; | | 1198 | return true; |
1149 | } | | 1199 | } |
1150 | | | 1200 | |
1151 | $parent = dirname($dir); | | 1201 | $parent = dirname($dir); |
1152 | $ok = true; | | 1202 | $ok = true; |
1153 | if (!@is_dir($parent) && $parent != $dir) { | | 1203 | if (!@is_dir($parent) && $parent != $dir) { |
1154 | $ok = mkdir_p(dirname($dir), $mode); | | 1204 | $ok = mkdir_p(dirname($dir), $mode); |
1155 | } | | 1205 | } |
1156 | if ($ok) { | | 1206 | if ($ok) { |
1157 | $ok = @mkdir($dir, $mode); | | 1207 | $ok = @mkdir($dir, $mode); |
1158 | if (!$ok) { | | 1208 | // This is handled in the caller function (eg. webfrontend or not) |
1159 | print "mkdir failed: <$dir>\n"; | | 1209 | //if (!$ok) { |
1160 | } | | 1210 | // print "mkdir failed: <$dir>\n"; |
| | | 1211 | //} |
1161 | } | | 1212 | } |
1162 | return $ok; | | 1213 | return $ok; |
1163 | } | | 1214 | } |
1164 | | | 1215 | |
1165 | // }}} | | 1216 | // }}} |
1166 | // {{{ rm_rf() | | 1217 | // {{{ rm_rf() |
1167 | | | 1218 | |
1168 | function rm_rf($path) | | 1219 | function rm_rf($path) |
1169 | { | | 1220 | { |
1170 | if (@is_dir($path) && is_writable($path)) { | | 1221 | if (@is_dir($path) && is_writable($path)) { |
1171 | $dp = opendir($path); | | 1222 | $dp = opendir($path); |
1172 | while ($ent = readdir($dp)) { | | 1223 | while ($ent = readdir($dp)) { |
1173 | if ($ent == '.' || $ent == '..') { | | 1224 | if ($ent == '.' || $ent == '..') { |
| @@ -1197,32 +1248,33 @@ Please fix the permission or select a ne | | | @@ -1197,32 +1248,33 @@ Please fix the permission or select a ne |
1197 | */ | | 1248 | */ |
1198 | function temp_dir($default=false) | | 1249 | function temp_dir($default=false) |
1199 | { | | 1250 | { |
1200 | global $ptmp, $prefix; | | 1251 | global $ptmp, $prefix; |
1201 | | | 1252 | |
1202 | if ($default) { | | 1253 | if ($default) { |
1203 | if (!@is_dir($default)) { | | 1254 | if (!@is_dir($default)) { |
1204 | if (!mkdir_p($default)) { | | 1255 | if (!mkdir_p($default)) { |
1205 | return false; | | 1256 | return false; |
1206 | } | | 1257 | } |
1207 | } | | 1258 | } |
1208 | | | 1259 | |
1209 | /* try it really, is_writable is buggy with openbasedir */ | | 1260 | /* try it really, is_writable is buggy with openbasedir */ |
1210 | $fh = fopen(realpath($default) . "/test","wb"); | | 1261 | $fh = @fopen(realpath($default) . "/test","wb"); |
1211 | if ($fh) { | | 1262 | if ($fh) { |
1212 | $ptmp = $default; | | 1263 | // desparately try to set temp dir any possible way, see bug #13167 |
| | | 1264 | $ptmp = $_temp = $temp_dir = $default; |
| | | 1265 | putenv('TMPDIR='.$default); |
1213 | return true; | | 1266 | return true; |
1214 | } else { | | 1267 | } else { |
1215 | $ptmp = "failed"; | | | |
1216 | return false; | | 1268 | return false; |
1217 | } | | 1269 | } |
1218 | } | | 1270 | } |
1219 | | | 1271 | |
1220 | $_temp = false; | | 1272 | $_temp = false; |
1221 | if (WINDOWS){ | | 1273 | if (WINDOWS){ |
1222 | if ( my_env('TEMP') ) { | | 1274 | if ( my_env('TEMP') ) { |
1223 | $_temp = my_env('TEMP'); | | 1275 | $_temp = my_env('TEMP'); |
1224 | } elseif ( my_env('TMP') ) { | | 1276 | } elseif ( my_env('TMP') ) { |
1225 | $_temp = my_env('TMP'); | | 1277 | $_temp = my_env('TMP'); |
1226 | } elseif ( my_env('windir') ) { | | 1278 | } elseif ( my_env('windir') ) { |
1227 | $_temp = my_env('windir') . '\temp'; | | 1279 | $_temp = my_env('windir') . '\temp'; |
1228 | } elseif ( my_env('SystemRoot') ) { | | 1280 | } elseif ( my_env('SystemRoot') ) { |
| @@ -1250,27 +1302,27 @@ function temp_dir($default=false) | | | @@ -1250,27 +1302,27 @@ function temp_dir($default=false) |
1250 | $ptmp = $_temp; | | 1302 | $ptmp = $_temp; |
1251 | } else { | | 1303 | } else { |
1252 | $_temp = my_env('TMPDIR'); | | 1304 | $_temp = my_env('TMPDIR'); |
1253 | if (!$_temp) { | | 1305 | if (!$_temp) { |
1254 | if (is_writable('/tmp')) { | | 1306 | if (is_writable('/tmp')) { |
1255 | $_temp = '/tmp'; | | 1307 | $_temp = '/tmp'; |
1256 | } | | 1308 | } |
1257 | } | | 1309 | } |
1258 | } | | 1310 | } |
1259 | | | 1311 | |
1260 | // If for some reason the user has no rights to access to | | 1312 | // If for some reason the user has no rights to access to |
1261 | // the standard tempdir, we assume that he has the right | | 1313 | // the standard tempdir, we assume that he has the right |
1262 | // to access his prefix and choose $prefix/tmp as tempdir | | 1314 | // to access his prefix and choose $prefix/tmp as tempdir |
1263 | if (!$_temp) { | | 1315 | if (!$_temp || !is_writable($_temp)) { |
1264 | print "System's Tempdir failed, trying to use \$prefix/tmp ..."; | | 1316 | print "System's Tempdir failed, trying to use \$prefix/tmp ..."; |
1265 | $res = mkdir_p($prefix.'/tmp'); | | 1317 | $res = mkdir_p($prefix.'/tmp'); |
1266 | if (!$res) { | | 1318 | if (!$res) { |
1267 | bail('mkdir '.$prefix.'/tmp'.' ... failed'); | | 1319 | bail('mkdir '.$prefix.'/tmp'.' ... failed'); |
1268 | } | | 1320 | } |
1269 | | | 1321 | |
1270 | $ptmp = $prefix . '/tmp'; | | 1322 | $ptmp = $prefix . '/tmp'; |
1271 | $_temp = tempnam($prefix.'/tmp', 'gope'); | | 1323 | $_temp = tempnam($prefix.'/tmp', 'gope'); |
1272 | | | 1324 | |
1273 | rm_rf($_temp); | | 1325 | rm_rf($_temp); |
1274 | mkdir_p($_temp, 0700); | | 1326 | mkdir_p($_temp, 0700); |
1275 | $ok = @chdir($ptmp); | | 1327 | $ok = @chdir($ptmp); |
1276 | | | 1328 | |
| @@ -1357,32 +1409,34 @@ function detect_install_dirs($_prefix = | | | @@ -1357,32 +1409,34 @@ function detect_install_dirs($_prefix = |
1357 | } | | 1409 | } |
1358 | } | | 1410 | } |
1359 | if (!is_file($php_bin)) { | | 1411 | if (!is_file($php_bin)) { |
1360 | if (is_file('c:/php/cli/php.exe')) { | | 1412 | if (is_file('c:/php/cli/php.exe')) { |
1361 | $php_bin = 'c:/php/cli/php.exe'; | | 1413 | $php_bin = 'c:/php/cli/php.exe'; |
1362 | } elseif (is_file('c:/php5/php.exe')) { | | 1414 | } elseif (is_file('c:/php5/php.exe')) { |
1363 | $php_bin = 'c:/php5/php.exe'; | | 1415 | $php_bin = 'c:/php5/php.exe'; |
1364 | } elseif (is_file('c:/php4/cli/php.exe')) { | | 1416 | } elseif (is_file('c:/php4/cli/php.exe')) { |
1365 | $php_bin = 'c:/php4/cli/php.exe'; | | 1417 | $php_bin = 'c:/php4/cli/php.exe'; |
1366 | } | | 1418 | } |
1367 | } | | 1419 | } |
1368 | } else { | | 1420 | } else { |
1369 | if ($_prefix === null) { | | 1421 | if ($_prefix === null) { |
1370 | $prefix = dirname(PHP_BINDIR); | | 1422 | #$prefix = dirname(PHP_BINDIR); |
| | | 1423 | $prefix = dirname(__FILE__); |
1371 | } else { | | 1424 | } else { |
1372 | $prefix = $_prefix; | | 1425 | $prefix = $_prefix; |
1373 | } | | 1426 | } |
1374 | $bin_dir = '$prefix/bin'; | | 1427 | $bin_dir = '$prefix/bin'; |
1375 | $php_dir = '$prefix/share/pear'; | | 1428 | #$php_dir = '$prefix/share/pear'; |
| | | 1429 | $php_dir = '$prefix/PEAR'; |
1376 | $doc_dir = '$php_dir/docs'; | | 1430 | $doc_dir = '$php_dir/docs'; |
1377 | $data_dir = '$php_dir/data'; | | 1431 | $data_dir = '$php_dir/data'; |
1378 | $test_dir = '$php_dir/tests'; | | 1432 | $test_dir = '$php_dir/tests'; |
1379 | $temp_dir = '$prefix/temp'; | | 1433 | $temp_dir = '$prefix/temp'; |
1380 | | | 1434 | |
1381 | // check if the user has installed PHP with PHP or GNU layout | | 1435 | // check if the user has installed PHP with PHP or GNU layout |
1382 | if (@is_dir("$prefix/lib/php/.registry")) { | | 1436 | if (@is_dir("$prefix/lib/php/.registry")) { |
1383 | $php_dir = '$prefix/lib/php'; | | 1437 | $php_dir = '$prefix/lib/php'; |
1384 | } elseif (@is_dir("$prefix/share/pear/lib/.registry")) { | | 1438 | } elseif (@is_dir("$prefix/share/pear/lib/.registry")) { |
1385 | $php_dir = '$prefix/share/pear/lib'; | | 1439 | $php_dir = '$prefix/share/pear/lib'; |
1386 | $doc_dir = '$prefix/share/pear/docs'; | | 1440 | $doc_dir = '$prefix/share/pear/docs'; |
1387 | $data_dir = '$prefix/share/pear/data'; | | 1441 | $data_dir = '$prefix/share/pear/data'; |
1388 | $test_dir = '$prefix/share/pear/tests'; | | 1442 | $test_dir = '$prefix/share/pear/tests'; |
| @@ -1462,27 +1516,30 @@ function displayHTMLHeader() | | | @@ -1462,27 +1516,30 @@ function displayHTMLHeader() |
1462 | color: #006600; | | 1516 | color: #006600; |
1463 | text-align: left; | | 1517 | text-align: left; |
1464 | } | | 1518 | } |
1465 | | | 1519 | |
1466 | em { | | 1520 | em { |
1467 | font-weight: bold; | | 1521 | font-weight: bold; |
1468 | font-style: italic; | | 1522 | font-style: italic; |
1469 | } | | 1523 | } |
1470 | | | 1524 | |
1471 | .green { | | 1525 | .green { |
1472 | color: #006600; | | 1526 | color: #006600; |
1473 | } | | 1527 | } |
1474 | .red { | | 1528 | .red { |
1475 | color: #006600; | | 1529 | color: #ff0000; |
| | | 1530 | } |
| | | 1531 | .grey { |
| | | 1532 | color: #a9a9a9; |
1476 | } | | 1533 | } |
1477 | | | 1534 | |
1478 | span.headline { | | 1535 | span.headline { |
1479 | font-family: verdana,arial,helvetica,sans-serif; | | 1536 | font-family: verdana,arial,helvetica,sans-serif; |
1480 | font-size: 125%; | | 1537 | font-size: 125%; |
1481 | font-weight: bold; | | 1538 | font-weight: bold; |
1482 | color: #ffffff; | | 1539 | color: #ffffff; |
1483 | } | | 1540 | } |
1484 | | | 1541 | |
1485 | span.title { | | 1542 | span.title { |
1486 | font-family: verdana,arial,helvetica,sans-serif; | | 1543 | font-family: verdana,arial,helvetica,sans-serif; |
1487 | font-size: 110%; | | 1544 | font-size: 110%; |
1488 | font-weight: bold; | | 1545 | font-weight: bold; |
| @@ -1584,26 +1641,30 @@ function displayHTMLHeader() | | | @@ -1584,26 +1641,30 @@ function displayHTMLHeader() |
1584 | input.small, select.small { | | 1641 | input.small, select.small { |
1585 | font-family: verdana,arial,helvetica,sans-serif; | | 1642 | font-family: verdana,arial,helvetica,sans-serif; |
1586 | font-size: 75%; | | 1643 | font-size: 75%; |
1587 | } | | 1644 | } |
1588 | | | 1645 | |
1589 | textarea.small { | | 1646 | textarea.small { |
1590 | font-family: verdana,arial,helvetica,sans-serif; | | 1647 | font-family: verdana,arial,helvetica,sans-serif; |
1591 | font-size: 75%; | | 1648 | font-size: 75%; |
1592 | } | | 1649 | } |
1593 | | | 1650 | |
1594 | form { | | 1651 | form { |
1595 | margin-bottom : 0; | | 1652 | margin-bottom : 0; |
1596 | } | | 1653 | } |
| | | 1654 | hr { |
| | | 1655 | text-align: left; |
| | | 1656 | width: 80%; |
| | | 1657 | } |
1597 | --> | | 1658 | --> |
1598 | </style> | | 1659 | </style> |
1599 | <meta name="description" content="This is the Web Interface of the PEAR Installer" /> | | 1660 | <meta name="description" content="This is the Web Interface of the PEAR Installer" /> |
1600 | </head> | | 1661 | </head> |
1601 | | | 1662 | |
1602 | <body topmargin="0" leftmargin="0" | | 1663 | <body topmargin="0" leftmargin="0" |
1603 | marginheight="0" marginwidth="0" | | 1664 | marginheight="0" marginwidth="0" |
1604 | bgcolor="#ffffff" | | 1665 | bgcolor="#ffffff" |
1605 | text="#000000" | | 1666 | text="#000000" |
1606 | link="#006600" | | 1667 | link="#006600" |
1607 | alink="#cccc00" | | 1668 | alink="#cccc00" |
1608 | vlink="#003300" | | 1669 | vlink="#003300" |
1609 | > | | 1670 | > |
| @@ -1620,63 +1681,83 @@ function displayHTML($page = 'Welcome', | | | @@ -1620,63 +1681,83 @@ function displayHTML($page = 'Welcome', |
1620 | displayHTMLHeader(); | | 1681 | displayHTMLHeader(); |
1621 | | | 1682 | |
1622 | ?> | | 1683 | ?> |
1623 | <a name="TOP" /></a> | | 1684 | <a name="TOP" /></a> |
1624 | <table border="0" cellspacing="0" cellpadding="0" height="48" width="100%"> | | 1685 | <table border="0" cellspacing="0" cellpadding="0" height="48" width="100%"> |
1625 | <tr bgcolor="#339900"> | | 1686 | <tr bgcolor="#339900"> |
1626 | <td align="left" width="120"> | | 1687 | <td align="left" width="120"> |
1627 | <img src="<?php echo basename(__FILE__); ?>?action=img&img=pearlogo" width="104" height="50" vspace="2" hspace="5" alt="PEAR"> | | 1688 | <img src="<?php echo basename(__FILE__); ?>?action=img&img=pearlogo" width="104" height="50" vspace="2" hspace="5" alt="PEAR"> |
1628 | </td> | | 1689 | </td> |
1629 | <td align="left" valign="middle" width="20"> | | 1690 | <td align="left" valign="middle" width="20"> |
1630 | | | 1691 | |
1631 | </td> | | 1692 | </td> |
1632 | <td align="left" valign="middle"> | | 1693 | <td align="left" valign="middle"> |
1633 | <span class="Headline">Go-PEAR</span> | | 1694 | <span class="Headline">Go-PEAR Installer</span> |
1634 | </td> | | 1695 | </td> |
1635 | </tr> | | 1696 | </tr> |
1636 | | | 1697 | |
1637 | <tr bgcolor="#003300"><td colspan="3"></td></tr> | | 1698 | <tr bgcolor="#003300"><td colspan="3"></td></tr> |
1638 | | | 1699 | |
1639 | <tr bgcolor="#006600"> | | 1700 | <tr bgcolor="#006600"> |
1640 | <td align="right" valign="top" colspan="3"> | | 1701 | <td align="right" valign="top" colspan="3"> |
1641 | <span style="color: #ffffff">Version <?php echo GO_PEAR_VER; ?></span> <br /> | | 1702 | <span style="color: #ffffff">Version <?php echo GO_PEAR_VER; ?></span> <br /> |
1642 | </td> | | 1703 | </td> |
1643 | </tr> | | 1704 | </tr> |
1644 | | | 1705 | |
1645 | <tr bgcolor="#003300"><td colspan="3"></td></tr> | | 1706 | <tr bgcolor="#003300"><td colspan="3"></td></tr> |
1646 | </table> | | 1707 | </table> |
1647 | | | 1708 | |
1648 | | | 1709 | |
1649 | <table cellpadding="0" cellspacing="0" width="100%"> | | 1710 | <table cellpadding="0" cellspacing="0" width="100%"> |
1650 | <tr valign="top"> | | 1711 | <tr valign="top"> |
1651 | <td bgcolor="#f0f0f0" width="100"> | | 1712 | <td bgcolor="#f0f0f0" width="100"> |
1652 | <table width="200" border="0" cellpadding="4" cellspacing="0"> | | 1713 | <table width="200" border="0" cellpadding="4" cellspacing="0"> |
1653 | <tr valign="top"> | | 1714 | <tr valign="top"> |
1654 | <td style="font-size: 90%" align="left" width="200"> | | 1715 | <td style="font-size: 90%" align="left" width="200"> |
1655 | <br><br> | | 1716 | <p><br /> |
1656 | <img src="<?php echo basename(__FILE__); ?>?action=img&img=smallpear" border="0"> | | 1717 | <?php |
1657 | <a href="<?php echo basename(__FILE__); ?>?step=Welcome&restart=1" <?php if ($page == 'Welcome') echo ' class="green"'; ?>> | | 1718 | $menus = array('Welcome' => 'Welcome to Go-PEAR', |
1658 | Welcome to Go-PEAR | | 1719 | 'config' => 'Configuration', |
1659 | </a><br/> | | 1720 | 'preinstall' => 'Installation', |
1660 | | | 1721 | 'install' => 'Completed'); |
1661 | <img src="<?php echo basename(__FILE__); ?>?action=img&img=smallpear" border="0"> | | 1722 | $after_current = false; |
1662 | <a href="<?php echo basename(__FILE__); ?>?step=config" <?php if ($page == 'config') echo ' class="green"'; ?>> | | 1723 | |
1663 | Configuration | | 1724 | // Menu robustness (a bit low, but better then never) |
1664 | </a><br/> | | 1725 | if ($page == 'error') { |
1665 | | | 1726 | $_GET['last'] = $_GET['step']; |
1666 | <img src="<?php echo basename(__FILE__); ?>?action=img&img=smallpear" border="0"> | | 1727 | $after_current = true; |
1667 | <?php if ($page == 'install') echo '<span class="green">'; ?> | | 1728 | } elseif (!array_key_exists($page, $menus)) { |
1668 | Complete installation<br/> | | 1729 | $page = 'Welcome'; |
1669 | <?php if ($page == 'install') echo '</span>'; ?> | | 1730 | } |
| | | 1731 | |
| | | 1732 | foreach ($menus as $menu => $descr) { |
| | | 1733 | print('<img src="'.basename(__FILE__).'?action=img&img=smallpear" alt="" />'); |
| | | 1734 | |
| | | 1735 | if (!$after_current) { |
| | | 1736 | $class = ''; |
| | | 1737 | if ($page == $menu) { |
| | | 1738 | $class = 'green'; |
| | | 1739 | } |
| | | 1740 | if (!isSet($_GET['last'])) { $_GET['last'] = $page; } |
| | | 1741 | print('<a href="'.basename(__FILE__).'?step='.$menu.'&last='.$_GET['last'].'" class="'.$class.'">'.$descr.'</a><br />'); |
| | | 1742 | |
| | | 1743 | if ($_GET['last'] == $menu) { |
| | | 1744 | $after_current = true; |
| | | 1745 | } |
| | | 1746 | } else { |
| | | 1747 | print('<span class="grey">'.$descr.'</span><br />'); |
| | | 1748 | } |
| | | 1749 | } |
| | | 1750 | ?> |
1670 | | | 1751 | |
1671 | </td> | | 1752 | </td> |
1672 | </tr> | | 1753 | </tr> |
1673 | </table> | | 1754 | </table> |
1674 | </td> | | 1755 | </td> |
1675 | <td bgcolor="#cccccc" width="1" background="/gifs/checkerboard.gif"></td> | | 1756 | <td bgcolor="#cccccc" width="1" background="/gifs/checkerboard.gif"></td> |
1676 | <td> | | 1757 | <td> |
1677 | <table width="100%" cellpadding="10" cellspacing="0"> | | 1758 | <table width="100%" cellpadding="10" cellspacing="0"> |
1678 | <tr> | | 1759 | <tr> |
1679 | <td valign="top"> | | 1760 | <td valign="top"> |
1680 | | | 1761 | |
1681 | <table border="0"> | | 1762 | <table border="0"> |
1682 | <tr> | | 1763 | <tr> |
| @@ -1684,161 +1765,232 @@ function displayHTML($page = 'Welcome', | | | @@ -1684,161 +1765,232 @@ function displayHTML($page = 'Welcome', |
1684 | </td> | | 1765 | </td> |
1685 | <td> | | 1766 | <td> |
1686 | <?php | | 1767 | <?php |
1687 | if ($page == 'error') { | | 1768 | if ($page == 'error') { |
1688 | ?> | | 1769 | ?> |
1689 | <span class="title">Error</span><br/> | | 1770 | <span class="title">Error</span><br/> |
1690 | <br/> | | 1771 | <br/> |
1691 | <?php | | 1772 | <?php |
1692 | $value = $data; | | 1773 | $value = $data; |
1693 | if (preg_match('/ok$/', $value)) { | | 1774 | if (preg_match('/ok$/', $value)) { |
1694 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); | | 1775 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); |
1695 | } | | 1776 | } |
1696 | if (preg_match('/failed$/', $value)) { | | 1777 | if (preg_match('/failed$/', $value)) { |
1697 | $value = preg_replace('/(failed)$/', '<span style="color: #ff0000">\1</span>', $value); | | 1778 | $value = preg_replace('/(failed)$/', '<span class="red">\1</span>', $value); |
1698 | } | | 1779 | } |
1699 | if (preg_match('/^install ok:/', $value)) { | | 1780 | if (preg_match('/^install ok:/', $value)) { |
1700 | $value = preg_replace('/^(install ok:)/', '<span class="green">\1</span>', $value); | | 1781 | $value = preg_replace('/^(install ok:)/', '<span class="green">\1</span>', $value); |
1701 | } | | 1782 | } |
1702 | if (preg_match('/^Warning:/', $value)) { | | 1783 | if (preg_match('/^Warning:/', $value)) { |
1703 | $value = '<span style="color: #ff0000">'.$value.'</span>'; | | 1784 | $value = '<span style="color: #ff0000">'.$value.'</span>'; |
1704 | } | | 1785 | } |
1705 | | | 1786 | |
1706 | echo nl2br($value); | | 1787 | echo nl2br($value); |
1707 | } elseif ($page == 'Welcome') { | | 1788 | } elseif ($page == 'Welcome') { |
1708 | ?> | | 1789 | ?> |
1709 | <span class="title">Welcome to go-pear <?php echo GO_PEAR_VER; ?>!</span><br/> | | 1790 | <span class="title">Welcome to go-pear <?php echo GO_PEAR_VER; ?>!</span><br/> |
1710 | <br/> | | 1791 | <p> |
1711 | Go-pear will install the Web Frontend of the PEAR Installer and all the needed <br/> | | 1792 | Go-pear will install Pear, its Web Frontend and all the needed files. This<br/> |
1712 | files. This frontend is your tool for PEAR installation and maintenance.<br/> | | 1793 | frontend is your tool for PEAR installation and maintenance. |
1713 | <br/> | | 1794 | </p> |
1714 | Go-pear also lets you download and install the PEAR packages bundled<br/> | | 1795 | <p> |
1715 | with PHP: <?php echo implode(', ', $GLOBALS['pfc_packages']); ?>.<br/> | | 1796 | Go-pear also lets you download and install the following optional PEAR<br/> |
1716 | <br/> | | 1797 | packages: <?php echo implode(', ', array_keys($GLOBALS['pfc_packages'])); ?>. |
1717 | <a href="<?php echo basename(__FILE__); ?>?step=config" class="green">Next >></a> | | 1798 | </p> |
| | | 1799 | |
| | | 1800 | <a href="<?php echo basename(__FILE__); ?>?step=config&restart=1" class="green">Next >></a> |
1718 | <?php | | 1801 | <?php |
1719 | } elseif ($page == 'config') { | | 1802 | } elseif ($page == 'config') { |
1720 | if (!empty($GLOBALS['http_proxy'])) { | | 1803 | if (!empty($GLOBALS['http_proxy'])) { |
1721 | list($proxy_host, $proxy_port) = explode(':', $GLOBALS['http_proxy']); | | 1804 | $tmp_proxy = parse_url($GLOBALS['http_proxy']); |
| | | 1805 | |
| | | 1806 | $proxy_host = $tmp_proxy['scheme'] . '://'; |
| | | 1807 | if ($tmp_proxy['user'] != '') { |
| | | 1808 | $proxy_host .= $tmp_proxy['user']; |
| | | 1809 | if ($tmp_proxy['pass'] != '') { |
| | | 1810 | $proxy_host .= ':' . $tmp_proxy['pass']; |
| | | 1811 | } |
| | | 1812 | $proxy_host .= '@'; |
| | | 1813 | } |
| | | 1814 | $proxy_host .= $tmp_proxy['host']; |
| | | 1815 | $proxy_port = $tmp_proxy['port']; |
1722 | } else { | | 1816 | } else { |
1723 | $proxy_host = $proxy_port = ''; | | 1817 | $proxy_host = $proxy_port = ''; |
1724 | } | | 1818 | } |
1725 | ?> | | 1819 | ?> |
1726 | <form action="<?php echo basename(__FILE__);?>?step=install" method="post"> | | 1820 | <form action="<?php echo basename(__FILE__);?>?step=install" method="post"> |
1727 | <span class="title">Configuration</span><br/> | | 1821 | <!-- Packages stuff --> |
1728 | <br/> | | 1822 | <span class="title">Packages</span> |
1729 | HTTP proxy (host:port): | | 1823 | <p> |
1730 | <input type="text" name="proxy[host]" value="<?php echo $proxy_host;?>"> | | 1824 | The following PEAR packages will be installed. You can select some optional<br /> |
1731 | <input type="text" name="proxy[port]" value="<?php echo $proxy_port;?>" size="6"> | | 1825 | packages to be installed by go-pear too:<br /> |
1732 | <br/><br/><hr/><br/> | | 1826 | </p> |
1733 | Below is a suggested file layout for your new PEAR installation. <br/> | | 1827 | <table border="0"> |
1734 | <br/> | | 1828 | <tr> |
1735 | <table border="0"> | | 1829 | <th> </th><th>Package</th><th width="65%">Description</th> |
1736 | <TR> | | 1830 | </tr><tr> |
1737 | <TD valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" border="0"></TD> | | 1831 | <td>(required)</td><td>PEAR core</td><td>PEAR Base System</td> |
1738 | <TD> | | 1832 | </tr> |
| | | 1833 | |
| | | 1834 | <?php |
| | | 1835 | // automatically install frontend |
| | | 1836 | $frontend = 'PEAR_Frontend_Web-beta'; |
| | | 1837 | print('<tr><td>(required)<input type="hidden" name="'.$frontend.'" value="on" /></td><td>'.$frontend.'</td><td>'.$GLOBALS['pfc_packages'][$frontend].'</td></tr>'); |
| | | 1838 | unset($GLOBALS['pfc_packages'][$frontend]); |
| | | 1839 | |
| | | 1840 | foreach ($GLOBALS['pfc_packages'] as $var => $descr) { |
| | | 1841 | $checked = ''; |
| | | 1842 | if (in_array($var, $GLOBALS['install_optional_packages'])) { $checked = ' checked'; } |
| | | 1843 | printf('<tr><td align="center"><input type="checkbox" name="%s"%s></td><td>%s</td><td>%s</td></tr>', |
| | | 1844 | $var, |
| | | 1845 | $checked, |
| | | 1846 | $var, |
| | | 1847 | $descr); |
| | | 1848 | } |
| | | 1849 | ?> |
| | | 1850 | </table> |
| | | 1851 | <hr /> |
| | | 1852 | |
| | | 1853 | <!-- Configuration stuff --> |
| | | 1854 | <span class="title">Configuration</span> |
| | | 1855 | <p> |
| | | 1856 | Below is a suggested file layout for your new PEAR installation. |
| | | 1857 | </p> |
| | | 1858 | |
| | | 1859 | <!-- |
| | | 1860 | <p> |
| | | 1861 | <table border="0"> |
| | | 1862 | <tr> |
| | | 1863 | <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" /></td> |
| | | 1864 | <td> |
1739 | <span class="green"> | | 1865 | <span class="green"> |
1740 | <b>Note:</b> Make sure that PHP has the permission to access the specified<br/> | | 1866 | <b>Note:</b> Make sure that PHP has the permission to access the specified<br/> |
1741 | directories.<br/><br/> | | 1867 | directories. |
1742 | </span> | | 1868 | </span> |
1743 | </TD> | | 1869 | </td> |
1744 | </TR> | | 1870 | </tr> |
1745 | </table> | | 1871 | </table> |
1746 | <TABLE border="0"> | | 1872 | </p> |
| | | 1873 | --> |
| | | 1874 | |
| | | 1875 | <table border="0" width="80%"> |
1747 | <?php | | 1876 | <?php |
1748 | // Display error messages | | 1877 | foreach ($GLOBALS['config_vars'] as $n => $var) { |
1749 | if (isset($GLOBALS['www_errors']) && sizeof($GLOBALS['www_errors']) ) { | | 1878 | $error_class = ''; |
1750 | $www_errors = $GLOBALS['www_errors']; | | 1879 | if (is_array($GLOBALS['config_errors']) && array_key_exists($var, $GLOBALS['config_errors'])) { |
1751 | echo "<tr><td>"; | | 1880 | // www_error for this var |
1752 | echo '<span class="red">ERROR(S):</span>'; | | 1881 | $error_class = ' class="red"'; |
1753 | echo "</td></tr>"; | | | |
1754 | foreach ($www_errors as $n => $var) { | | | |
1755 | echo "<tr><td>"; | | | |
1756 | echo '<span class="red">'.$GLOBALS['config_desc'][$n].': </span>'; | | | |
1757 | echo "</td><td>"; | | | |
1758 | echo '<span class="red">'.$www_errors[$n].'</span>'; | | | |
1759 | echo "<br>\n"; | | | |
1760 | echo "</td></tr>\n"; | | | |
1761 | } | | 1882 | } |
1762 | } | | | |
1763 | | | 1883 | |
1764 | foreach ($GLOBALS['config_vars'] as $n => $var) { | | 1884 | printf('<tr><td>%d. %s</td><td><input type="text" name="config[%s]" value="%s"%s></td></tr>', |
1765 | printf('<tr><td>%d. %s</td><td><input type="text" name="config[%s]" value="%s"></td></tr>', | | | |
1766 | $n, | | 1885 | $n, |
1767 | $GLOBALS['config_desc'][$var], | | 1886 | $GLOBALS['config_desc'][$var], |
1768 | $var, | | 1887 | $var, |
1769 | $GLOBALS[$var]); | | 1888 | $_SESSION['go-pear']['config'][$var], |
| | | 1889 | $error_class); |
| | | 1890 | |
| | | 1891 | // prefix dir, check perm (uses GLOBALS: resolved subvars) |
| | | 1892 | if ($n == 1 && is_dir($GLOBALS[$var]) && !is_writable($GLOBALS[$var])) { |
| | | 1893 | $error = '<em>WARNING!</em> No permission to create subdirectories in this prefix dir. Unless you fix this, the default configuration will not work.'; |
| | | 1894 | if (!WINDOWS) { |
| | | 1895 | $error .= '<p>You can grant this permission by logging on to the server and issuing the following command:<br /> |
| | | 1896 | <tt>chmod 0777 '.$GLOBALS[$var].'</tt></p>'; |
| | | 1897 | } |
| | | 1898 | print('<tr><td colspan="2" class="green">'.$error.'</td></tr>'); |
| | | 1899 | } |
| | | 1900 | |
| | | 1901 | |
| | | 1902 | if (is_array($GLOBALS['config_errors']) && array_key_exists($var, $GLOBALS['config_errors'])) { |
| | | 1903 | // www_error for this var |
| | | 1904 | print('<tr><td colspan="2" class="red">'.$GLOBALS['config_errors'][$var].'</td></tr>'); |
| | | 1905 | } |
1770 | } | | 1906 | } |
1771 | ?> | | 1907 | ?> |
1772 | </TABLE> | | | |
1773 | <br/><hr/><br/> | | | |
1774 | The following PEAR packages are common ones, and can be installed<br/> | | | |
1775 | by go-pear too: <br/> | | | |
1776 | <?php echo implode(', ', $GLOBALS['pfc_packages']);?>.<br/> | | | |
1777 | <input type="checkbox" name="install_pfc" <?php if($GLOBALS['install_pfc']) ?>> Install those too<br/> | | | |
1778 | <br/><br/> | | | |
1779 | <table border="0"> | | | |
1780 | <TR> | | | |
1781 | <TD valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" border="0"></TD> | | | |
1782 | <TD> | | | |
1783 | <span class="green"> | | | |
1784 | <b>Note:</b> Installation might take some time, because go-pear has to download<br/> | | | |
1785 | all needed files from pear.php.net. Just be patient and wait for the next<br/> | | | |
1786 | page to load.<br/> | | | |
1787 | </span> | | | |
1788 | </TD> | | | |
1789 | </TR> | | | |
1790 | </table> | | 1908 | </table> |
1791 | <br> | | 1909 | </p> |
1792 | <input type="checkbox" name="BCmode" id="BCmode" checked> Compatibility-Mode for old non-DOM Browsers<br/> | | 1910 | <hr /> |
| | | 1911 | |
| | | 1912 | <!-- Optional stuff --> |
| | | 1913 | <span class="title">Optional:</span> |
| | | 1914 | |
| | | 1915 | <ul> |
| | | 1916 | <p> |
| | | 1917 | <li />HTTP proxy (host:port) |
| | | 1918 | <input type="text" name="proxy[host]" value="<?php echo $proxy_host;?>"> : <input type="text" name="proxy[port]" value="<?php echo $proxy_port;?>" size="6"> |
| | | 1919 | </p> |
| | | 1920 | |
| | | 1921 | <p> |
| | | 1922 | <li />Compatibility-Mode for old non-DOM Browsers <input type="checkbox" name="BCmode" id="BCmode" checked> |
1793 | <script type="text/javascript"> | | 1923 | <script type="text/javascript"> |
1794 | <!-- | | 1924 | <!-- |
1795 | if (document.getElementById('BCmode')) { | | 1925 | if (document.getElementById('BCmode')) { |
1796 | document.getElementById('BCmode').checked = 0; | | 1926 | document.getElementById('BCmode').checked = 0; |
1797 | }; | | 1927 | }; |
1798 | // --> | | 1928 | // --> |
1799 | </script> | | 1929 | </script> |
| | | 1930 | </p> |
| | | 1931 | </ul> |
1800 | | | 1932 | |
1801 | <?php | | 1933 | <?php |
1802 | if (WINDOWS && phpversion() == '4.1.1') { | | 1934 | if (WINDOWS && phpversion() == '4.1.1') { |
1803 | ?> | | 1935 | ?> |
| | | 1936 | <p> |
1804 | <table border="0"> | | 1937 | <table border="0"> |
1805 | <TR> | | 1938 | <tr> |
1806 | <TD valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" border="0"></TD> | | 1939 | <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" alt="" /></td> |
1807 | <TD> | | 1940 | <td> |
1808 | <span style="color: #ff0000"> | | 1941 | <span style="color: #ff0000"> |
1809 | <b>Warning:</b> Your PHP version (4.1.1) might be imcompatible with go-pear due to a bug<br/> | | 1942 | <b>Warning:</b> Your PHP version (4.1.1) might be imcompatible with go-pear due to a bug<br/> |
1810 | in your PHP binary. If the installation crashes you might want to update your PHP version.</br> | | 1943 | in your PHP binary. If the installation crashes you might want to update your PHP version.</br> |
1811 | </span> | | 1944 | </span> |
1812 | </TD> | | 1945 | </td> |
1813 | </TR> | | 1946 | </tr> |
1814 | </table> | | 1947 | </table> |
| | | 1948 | </p> |
1815 | <?php | | 1949 | <?php |
1816 | } | | 1950 | } |
1817 | ?> | | 1951 | ?> |
1818 | <br/> | | 1952 | <hr /> |
| | | 1953 | <!-- Closing note --> |
| | | 1954 | <p> |
| | | 1955 | <table border="0"> |
| | | 1956 | <tr> |
| | | 1957 | <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" alt="" /></td> |
| | | 1958 | <td> |
| | | 1959 | <span class="green"> |
| | | 1960 | <b>Note:</b> Installation might take some time, because go-pear has to<br/> |
| | | 1961 | download all needed files from pear.php.net. Just be patient and wait for<br/> |
| | | 1962 | the next page to load.<br/> |
| | | 1963 | </span> |
| | | 1964 | </td> |
| | | 1965 | </tr> |
| | | 1966 | </table> |
| | | 1967 | </p> |
| | | 1968 | |
1819 | <input type="submit" value="Install" onClick="javascript: submitButton.value='Downloading and installing ... please wait ...'" name="submitButton"> | | 1969 | <input type="submit" value="Install" onClick="javascript: submitButton.value='Downloading and installing ... please wait ...'" name="submitButton"> |
1820 | </form> | | 1970 | </form> |
| | | 1971 | |
1821 | <?php | | 1972 | <?php |
1822 | } elseif ($page == 'install') { | | 1973 | } elseif ($page == 'install') { |
1823 | ?> | | 1974 | ?> |
1824 | <span class="title">Installation Complete - Summary</span><br/> | | 1975 | <span class="title">Installation Complete - Summary</span><br/> |
1825 | <?php | | 1976 | <?php |
1826 | displayHTMLInstallationSummary($data); | | 1977 | displayHTMLInstallationSummary($data); |
1827 | } elseif ($page == 'preinstall') { | | 1978 | } elseif ($page == 'preinstall') { |
1828 | ?> | | 1979 | ?> |
1829 | <span class="title">Installation in progress ...</span><br/> | | 1980 | <p> |
1830 | <br/> | | 1981 | <span class="title">Installation in progress ...</span></br > |
1831 | <script language="javascript"> | | 1982 | <i>(If the page stops loading before the end of the installation, then just reload it)</i></p> |
| | | 1983 | <script type="text/javascript"> |
1832 | <!-- | | 1984 | <!-- |
1833 | | | 1985 | |
1834 | var progress; | | 1986 | var progress; |
1835 | var downloadprogress; | | 1987 | var downloadprogress; |
1836 | progress = 0; | | 1988 | progress = 0; |
1837 | downloadprogress = 0; | | 1989 | downloadprogress = 0; |
1838 | | | 1990 | |
1839 | function setprogress(value) | | 1991 | function setprogress(value) |
1840 | { | | 1992 | { |
1841 | progress = value; | | 1993 | progress = value; |
1842 | | | 1994 | |
1843 | prog = document.getElementById('installation_progress'); | | 1995 | prog = document.getElementById('installation_progress'); |
1844 | prog.innerHTML = progress + " %"; | | 1996 | prog.innerHTML = progress + " %"; |
| @@ -1875,26 +2027,34 @@ function displayHTML($page = 'Welcome', | | | @@ -1875,26 +2027,34 @@ function displayHTML($page = 'Welcome', |
1875 | { | | 2027 | { |
1876 | progress += value; | | 2028 | progress += value; |
1877 | setprogress(progress); | | 2029 | setprogress(progress); |
1878 | } | | 2030 | } |
1879 | | | 2031 | |
1880 | function setdownloadfile(value) | | 2032 | function setdownloadfile(value) |
1881 | { | | 2033 | { |
1882 | setdownloadprogress(0); | | 2034 | setdownloadprogress(0); |
1883 | | | 2035 | |
1884 | prog = document.getElementById('download_file'); | | 2036 | prog = document.getElementById('download_file'); |
1885 | prog.innerHTML = 'Downloading '+value+' ...'; | | 2037 | prog.innerHTML = 'Downloading '+value+' ...'; |
1886 | }; | | 2038 | }; |
1887 | | | 2039 | |
| | | 2040 | function unsetdownloadfile() |
| | | 2041 | { |
| | | 2042 | setdownloadprogress(0); |
| | | 2043 | |
| | | 2044 | prog = document.getElementById('download_file'); |
| | | 2045 | prog.innerHTML = ''; |
| | | 2046 | }; |
| | | 2047 | |
1888 | function setdownloadprogress(value) | | 2048 | function setdownloadprogress(value) |
1889 | { | | 2049 | { |
1890 | downloadprogress = value; | | 2050 | downloadprogress = value; |
1891 | | | 2051 | |
1892 | prog = document.getElementById('download_progress'); | | 2052 | prog = document.getElementById('download_progress'); |
1893 | prog.innerHTML = downloadprogress + " %"; | | 2053 | prog.innerHTML = downloadprogress + " %"; |
1894 | progress2 = downloadprogress / 10; | | 2054 | progress2 = downloadprogress / 10; |
1895 | progress2 = Math.floor(progress2); | | 2055 | progress2 = Math.floor(progress2); |
1896 | for (i=0; i < 10; i++) | | 2056 | for (i=0; i < 10; i++) |
1897 | document.getElementById('download_progress_cell_'+i).style.backgroundColor = "#cccccc"; | | 2057 | document.getElementById('download_progress_cell_'+i).style.backgroundColor = "#cccccc"; |
1898 | switch(progress2) | | 2058 | switch(progress2) |
1899 | { | | 2059 | { |
1900 | case 10: | | 2060 | case 10: |
| @@ -1931,46 +2091,46 @@ function displayHTML($page = 'Welcome', | | | @@ -1931,46 +2091,46 @@ function displayHTML($page = 'Welcome', |
1931 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_1"> </td> | | 2091 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_1"> </td> |
1932 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_2"> </td> | | 2092 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_2"> </td> |
1933 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_3"> </td> | | 2093 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_3"> </td> |
1934 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_4"> </td> | | 2094 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_4"> </td> |
1935 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_5"> </td> | | 2095 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_5"> </td> |
1936 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_6"> </td> | | 2096 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_6"> </td> |
1937 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_7"> </td> | | 2097 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_7"> </td> |
1938 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_8"> </td> | | 2098 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_8"> </td> |
1939 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_9"> </td> | | 2099 | <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_9"> </td> |
1940 | <td bgcolor="#ffffff" width="10" height="20"> </td> | | 2100 | <td bgcolor="#ffffff" width="10" height="20"> </td> |
1941 | <td bgcolor="#ffffff" height="20" id="installation_progress" class="green">0 %</td> | | 2101 | <td bgcolor="#ffffff" height="20" id="installation_progress" class="green">0 %</td> |
1942 | </tr> | | 2102 | </tr> |
1943 | </table> | | 2103 | </table> |
1944 | <br> | | 2104 | <br /> |
1945 | <table border="0"> | | 2105 | <table border="0"> |
1946 | <tr> | | 2106 | <tr> |
1947 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_0"> </td> | | 2107 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_0"> </td> |
1948 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_1"> </td> | | 2108 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_1"> </td> |
1949 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_2"> </td> | | 2109 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_2"> </td> |
1950 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_3"> </td> | | 2110 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_3"> </td> |
1951 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_4"> </td> | | 2111 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_4"> </td> |
1952 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_5"> </td> | | 2112 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_5"> </td> |
1953 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_6"> </td> | | 2113 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_6"> </td> |
1954 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_7"> </td> | | 2114 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_7"> </td> |
1955 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_8"> </td> | | 2115 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_8"> </td> |
1956 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_9"> </td> | | 2116 | <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_9"> </td> |
1957 | <td bgcolor="#ffffff" width="10" height="20"> </td> | | 2117 | <td bgcolor="#ffffff" width="10" height="20"> </td> |
1958 | <td bgcolor="#ffffff" height="20" id="download_progress" class="green">0 %</td> | | 2118 | <td bgcolor="#ffffff" height="20" id="download_progress" class="green">0 %</td> |
1959 | <td bgcolor="#ffffff" width="10" height="20"> </td> | | 2119 | <td bgcolor="#ffffff" width="10" height="20"> </td> |
1960 | <td bgcolor="#ffffff" height="20" id="download_file" class="green"></td> | | 2120 | <td bgcolor="#ffffff" height="20" id="download_file" class="green"></td> |
1961 | </tr> | | 2121 | </tr> |
1962 | </table> | | 2122 | </table> |
1963 | <br> | | 2123 | <br /> |
1964 | <iframe src="<?php echo basename(__FILE__); ?>?step=install-progress&<?php echo SID;?>" width="700" height="700" frameborder="0" marginheight="0" marginwidth="0"></iframe> | | 2124 | <iframe src="<?php echo basename(__FILE__); ?>?step=install-progress&<?php echo SID;?>" width="700" height="700" frameborder="0" marginheight="0" marginwidth="0"></iframe> |
1965 | </td> | | 2125 | </td> |
1966 | </tr> | | 2126 | </tr> |
1967 | </table> | | 2127 | </table> |
1968 | <?php | | 2128 | <?php |
1969 | } | | 2129 | } |
1970 | ?> | | 2130 | ?> |
1971 | </td> | | 2131 | </td> |
1972 | </tr> | | 2132 | </tr> |
1973 | </table> | | 2133 | </table> |
1974 | | | 2134 | |
1975 | | | 2135 | |
1976 | </td> | | 2136 | </td> |
| @@ -1991,82 +2151,93 @@ function displayHTMLFooter() | | | @@ -1991,82 +2151,93 @@ function displayHTMLFooter() |
1991 | { | | 2151 | { |
1992 | ?> | | 2152 | ?> |
1993 | </body> | | 2153 | </body> |
1994 | </html> | | 2154 | </html> |
1995 | <?php | | 2155 | <?php |
1996 | }; | | 2156 | }; |
1997 | | | 2157 | |
1998 | // }}} | | 2158 | // }}} |
1999 | // {{{ displayHTMLInstallationSummary | | 2159 | // {{{ displayHTMLInstallationSummary |
2000 | | | 2160 | |
2001 | function displayHTMLInstallationSummary($data = '') | | 2161 | function displayHTMLInstallationSummary($data = '') |
2002 | { | | 2162 | { |
2003 | $next = NULL; | | 2163 | $next = NULL; |
2004 | $file = $GLOBALS['webfrontend_file']; | | 2164 | $file = $GLOBALS['webfrontend_file']; |
2005 | $doc_root = strip_magic_quotes($_SERVER['DOCUMENT_ROOT']); | | 2165 | $doc_root = strip_magic_quotes($_SERVER['DOCUMENT_ROOT']); |
2006 | $file_dir = dirname(__FILE__); | | 2166 | $file_dir = dirname(__FILE__); |
2007 | if ( WINDOWS ) { | | 2167 | if ( WINDOWS ) { |
2008 | $file = str_replace('/', '\\', strtolower($file)); | | 2168 | $file = str_replace('/', '\\', strtolower($file)); |
2009 | $doc_root = str_replace('/', '\\', strtolower($doc_root)); | | 2169 | $doc_root = str_replace('/', '\\', strtolower($doc_root)); |
2010 | $file_dir = str_replace('/', '\\', strtolower($file_dir)); | | 2170 | $file_dir = str_replace('/', '\\', strtolower($file_dir)); |
2011 | } | | 2171 | } |
2012 | | | 2172 | |
2013 | if ($doc_root && substr($file, 0, strlen($doc_root)) == $doc_root) { | | 2173 | if ($doc_root && substr($file, 0, strlen($doc_root)) == $doc_root) { |
2014 | $next = substr($file, strlen($doc_root)); | | 2174 | $next = substr($file, strlen($doc_root)); |
2015 | } elseif ($file_dir && substr($file, 0, strlen($file_dir)) == $file_dir) { | | 2175 | // need leading / (file - docroot = path from docroot) |
| | | 2176 | if (substr($next, 0, 1) != '/') { |
| | | 2177 | $next = '/'.$next; |
| | | 2178 | } |
| | | 2179 | } else if ($file_dir && substr($file, 0, strlen($file_dir)) == $file_dir) { |
2016 | $next = substr($file, strlen($file_dir)); | | 2180 | $next = substr($file, strlen($file_dir)); |
| | | 2181 | // strip leading / (file - file_dir = path from go-pear file) |
| | | 2182 | if (substr($next, 0, 1) == '/') { |
| | | 2183 | $next = substr($next, 1, strlen($next)); |
| | | 2184 | } |
2017 | } | | 2185 | } |
2018 | | | 2186 | |
2019 | if ($data) { | | 2187 | if ($data) { |
2020 | echo "<br/>".$data; | | 2188 | echo "<br/>".$data; |
2021 | } | | 2189 | } |
2022 | ?> | | 2190 | ?> |
2023 | <br/> | | 2191 | <p> |
| | | 2192 | <span class="title">Installation Completed !</span> |
| | | 2193 | </p> |
| | | 2194 | |
2024 | <table border="0"> | | 2195 | <table border="0"> |
2025 | <TR> | | 2196 | <tr> |
2026 | <TD valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" border="0"></TD> | | 2197 | <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" alt="" /></td> |
2027 | <TD> | | 2198 | <td> |
2028 | <span class="green"> | | 2199 | <span class="green"> |
2029 | <b>Note:</b> To use PEAR without any problems you need to add your<br/> | | 2200 | <b>Note:</b> To use PEAR without any problems you need to add your<br/> |
2030 | PEAR Installation path (<?php echo $GLOBALS['php_dir']; ?>)<br> | | 2201 | PEAR Installation path (<?php echo $GLOBALS['php_dir']; ?>)<br /> |
2031 | to your <a href="http://www.php.net/manual/en/configuration.directives.php#ini.include_path">include_path</a>.<br/> | | 2202 | to your <a href="http://www.php.net/manual/en/configuration.directives.php#ini.include_path">include_path</a>.<br/> |
2032 | <br/> | | 2203 | <br/> |
2033 | Using a .htaccess file or directly edit httpd.conf would be working solutions<br/> | | 2204 | Using a .htaccess file or directly edit httpd.conf would be working solutions<br/> |
2034 | for Apache running servers, too.<br/> | | 2205 | for Apache running servers, too.<br/> |
2035 | </span> | | 2206 | </span> |
2036 | </TD> | | 2207 | </td> |
2037 | </TR> | | 2208 | </tr> |
2038 | </table> | | 2209 | </table> |
2039 | <br/> | | 2210 | <br/> |
2040 | For more information about PEAR, see:<br/> | | 2211 | For more information about PEAR, see:<br/> |
2041 | <a href="http://pear.php.net/faq.php" target="_new" class="green">PEAR FAQ</a><br/> | | 2212 | <a href="http://pear.php.net/faq.php" target="_new" class="green">PEAR FAQ</a><br/> |
2042 | <a href="http://pear.php.net/manual/" target="_new" class="green">PEAR Manual</a><br/> | | 2213 | <a href="http://pear.php.net/manual/" target="_new" class="green">PEAR Manual</a><br/> |
2043 | <br/> | | 2214 | <br/> |
2044 | Thanks for using go-pear!<br/> | | 2215 | Thanks for using go-pear!<br/> |
2045 | <br/> | | 2216 | <br/> |
2046 | <?php | | 2217 | <?php |
2047 | if ($next === NULL) { | | 2218 | if ($next === NULL) { |
2048 | ?> | | 2219 | ?> |
2049 | <table border="0"> | | 2220 | <table border="0"> |
2050 | <TR> | | 2221 | <tr> |
2051 | <TD valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" border="0"></TD> | | 2222 | <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&img=note" alt="" /></td> |
2052 | <TD> | | 2223 | <td> |
2053 | <span style="color: #ff0000"> | | 2224 | <span style="color: #ff0000"> |
2054 | <b>Warning:</b> Go-PEAR was not able to determine the URL to the newly<br/> | | 2225 | <b>Warning:</b> Can not determine the URL of the freshly installed Web Frontend<br /> |
2055 | installed Web Frontend of the PEAR Installer. Please access it manually.<br/> | | 2226 | (file: <?php echo $file ?>).<br /> |
2056 | Since you specified the prefix, you should know how to do so.<br/> | | 2227 | Please access it manually ! |
2057 | </span> | | 2228 | </span> |
2058 | </TD> | | 2229 | </td> |
2059 | </TR> | | 2230 | </tr> |
2060 | </table> | | 2231 | </table> |
2061 | <?php | | 2232 | <?php |
2062 | } else { | | 2233 | } else { |
2063 | if ($_GET['step'] == 'install-progress') { | | 2234 | if ($_GET['step'] == 'install-progress') { |
2064 | ?> | | 2235 | ?> |
2065 | <a href="<?php echo $next;?>" class="green" target="_parent">Start Web Frontend of the PEAR Installer >></a> | | 2236 | <a href="<?php echo $next;?>" class="green" target="_parent">Start Web Frontend of the PEAR Installer >></a> |
2066 | <?php | | 2237 | <?php |
2067 | } else { | | 2238 | } else { |
2068 | ?> | | 2239 | ?> |
2069 | <a href="<?php echo $next;?>" class="green">Start Web Frontend of the PEAR Installer >></a> | | 2240 | <a href="<?php echo $next;?>" class="green">Start Web Frontend of the PEAR Installer >></a> |
2070 | <?php | | 2241 | <?php |
2071 | } | | 2242 | } |
2072 | } | | 2243 | } |
| @@ -2117,34 +2288,37 @@ function displayHTMLProgress($progress) | | | @@ -2117,34 +2288,37 @@ function displayHTMLProgress($progress) |
2117 | }; | | 2288 | }; |
2118 | $msg = ob_get_contents(); | | 2289 | $msg = ob_get_contents(); |
2119 | ob_end_clean(); | | 2290 | ob_end_clean(); |
2120 | | | 2291 | |
2121 | $msg = explode("\n", $msg); | | 2292 | $msg = explode("\n", $msg); |
2122 | foreach($msg as $key => $value) { | | 2293 | foreach($msg as $key => $value) { |
2123 | if (preg_match('/ok$/', $value)) { | | 2294 | if (preg_match('/ok$/', $value)) { |
2124 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); | | 2295 | $value = preg_replace('/(ok)$/', '<span class="green">\1</span>', $value); |
2125 | }; | | 2296 | }; |
2126 | if (preg_match('/failed$/', $value)) { | | 2297 | if (preg_match('/failed$/', $value)) { |
2127 | $value = preg_replace('/(failed)$/', '<span style="color: #ff0000">\1</span>', $value); | | 2298 | $value = preg_replace('/(failed)$/', '<span style="color: #ff0000">\1</span>', $value); |
2128 | }; | | 2299 | }; |
2129 | if (preg_match('/^install ok:/', $value)) { | | 2300 | if (preg_match('/^install ok:/', $value)) { |
2130 | $value = preg_replace('/^(install ok:)/', '<span class="green">\1</span>', $value); | | 2301 | //$value = preg_replace('/^(install ok:)/', '<span class="green">\1</span>', $value).'<br />'; |
| | | 2302 | //$msg = array($value); // if install succeeded: don't show the irritatingly verbose pear installer |
| | | 2303 | $msg = array('<span class="green">ok</span><br />'); |
| | | 2304 | break; |
2131 | }; | | 2305 | }; |
2132 | if (preg_match('/^Warning:/', $value)) { | | 2306 | if (preg_match('/^Warning:/', $value)) { |
2133 | $value = '<span style="color: #ff0000">'.$value.'</span>'; | | 2307 | $value = '<span style="color: #ff0000">'.$value.'</span>'; |
2134 | }; | | 2308 | }; |
2135 | $msg[$key] = $value; | | 2309 | $msg[$key] = $value; |
2136 | }; | | 2310 | }; |
2137 | $msg = implode('<br>', $msg); | | 2311 | $msg = implode('<br />', $msg); |
2138 | | | 2312 | |
2139 | $msg.='<script type="text/javascript"> parent.setprogress('.((int) $progress).'); </script>'; | | 2313 | $msg.='<script type="text/javascript"> parent.setprogress('.((int) $progress).'); </script>'; |
2140 | | | 2314 | |
2141 | echo $msg; | | 2315 | echo $msg; |
2142 | ob_start(); | | 2316 | ob_start(); |
2143 | }; | | 2317 | }; |
2144 | | | 2318 | |
2145 | // }}} | | 2319 | // }}} |
2146 | // {{{ displayHTMLDownloadProgress | | 2320 | // {{{ displayHTMLDownloadProgress |
2147 | | | 2321 | |
2148 | function displayHTMLDownloadProgress($progress) | | 2322 | function displayHTMLDownloadProgress($progress) |
2149 | { | | 2323 | { |
2150 | if (!(WEBINSTALLER && isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'])) { | | 2324 | if (!(WEBINSTALLER && isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'])) { |
| @@ -2160,27 +2334,31 @@ function displayHTMLDownloadProgress($pr | | | @@ -2160,27 +2334,31 @@ function displayHTMLDownloadProgress($pr |
2160 | }; | | 2334 | }; |
2161 | | | 2335 | |
2162 | // }}} | | 2336 | // }}} |
2163 | // {{{ displayHTMLSetDownload | | 2337 | // {{{ displayHTMLSetDownload |
2164 | | | 2338 | |
2165 | function displayHTMLSetDownload($file) | | 2339 | function displayHTMLSetDownload($file) |
2166 | { | | 2340 | { |
2167 | if (!(WEBINSTALLER && isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'])) { | | 2341 | if (!(WEBINSTALLER && isset($_SESSION['go-pear']['DHTML']) && $_SESSION['go-pear']['DHTML'])) { |
2168 | return; | | 2342 | return; |
2169 | }; | | 2343 | }; |
2170 | $msg = ob_get_contents(); | | 2344 | $msg = ob_get_contents(); |
2171 | ob_end_clean(); | | 2345 | ob_end_clean(); |
2172 | | | 2346 | |
2173 | echo '<script type="text/javascript"> parent.setdownloadfile("'.$file.'"); </script>'; | | 2347 | if ($file != null && $file != '') { |
| | | 2348 | echo '<script type="text/javascript"> parent.setdownloadfile("'.$file.'"); </script>'; |
| | | 2349 | } else { |
| | | 2350 | echo '<script type="text/javascript"> parent.unsetdownloadfile(); </script>'; |
| | | 2351 | } |
2174 | | | 2352 | |
2175 | ob_start(); | | 2353 | ob_start(); |
2176 | echo $msg; | | 2354 | echo $msg; |
2177 | }; | | 2355 | }; |
2178 | | | 2356 | |
2179 | // }}} | | 2357 | // }}} |
2180 | // {{{ win32BrowseForFolder | | 2358 | // {{{ win32BrowseForFolder |
2181 | | | 2359 | |
2182 | /* | | 2360 | /* |
2183 | * Create a vbs script to browse the getfolder dialog, called | | 2361 | * Create a vbs script to browse the getfolder dialog, called |
2184 | * by cscript, if it's available. | | 2362 | * by cscript, if it's available. |
2185 | * $label is the label text in the header of the dialog box | | 2363 | * $label is the label text in the header of the dialog box |
2186 | * | | 2364 | * |
| @@ -2484,13 +2662,15 @@ $includepath | | | @@ -2484,13 +2662,15 @@ $includepath |
2484 | | | 2662 | |
2485 | "; | | 2663 | "; |
2486 | | | 2664 | |
2487 | } | | 2665 | } |
2488 | } else { | | 2666 | } else { |
2489 | fwrite($fh, $newIni, strlen($newIni)); | | 2667 | fwrite($fh, $newIni, strlen($newIni)); |
2490 | fclose($fh); | | 2668 | fclose($fh); |
2491 | echo " | | 2669 | echo " |
2492 | php.ini <$pathIni> include_path updated. | | 2670 | php.ini <$pathIni> include_path updated. |
2493 | "; | | 2671 | "; |
2494 | } | | 2672 | } |
2495 | return true; | | 2673 | return true; |
2496 | } | | 2674 | } |
| | | 2675 | |
| | | 2676 | ?> |