| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
+----------------------------------------------------------------------+
|
|
|
4 |
| PHP Version 4 |
|
|
|
5 |
+----------------------------------------------------------------------+
|
|
|
6 |
| Copyright (c) 1997-2003 The PHP Group |
|
|
|
7 |
+----------------------------------------------------------------------+
|
|
|
8 |
| This source file is subject to version 2.02 of the PHP license, |
|
|
|
9 |
| that is bundled with this package in the file LICENSE, and is |
|
|
|
10 |
| available at through the world-wide-web at |
|
|
|
11 |
| http://www.php.net/license/2_02.txt. |
|
|
|
12 |
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
13 |
| obtain it through the world-wide-web, please send a note to |
|
|
|
14 |
| license@php.net so we can mail you a copy immediately. |
|
|
|
15 |
+----------------------------------------------------------------------+
|
|
|
16 |
| Author: Christian Dickmann <dickmann@php.net> |
|
|
|
17 |
| Pierre-Alain Joye <pajoye@php.net> |
|
|
|
18 |
| Tias Guns <tias@ulyssis.org> |
|
|
|
19 |
+----------------------------------------------------------------------+
|
|
|
20 |
|
|
|
21 |
* Web-based PEAR Frontend, include this file to display the fontend.
|
|
|
22 |
* This file does the basic configuration, handles all requests and calls
|
|
|
23 |
* the needed commands.
|
|
|
24 |
*
|
|
|
25 |
* @category pear
|
|
|
26 |
* @package PEAR_Frontend_Web
|
|
|
27 |
* @author Christian Dickmann <dickmann@php.net>
|
|
|
28 |
* @author Pierre-Alain Joye <pajoye@php.net>
|
|
|
29 |
* @author Tias Guns <tias@ulyssis.org>
|
|
|
30 |
* @copyright 1997-2007 The PHP Group
|
|
|
31 |
* @license http://www.php.net/license/2_02.txt PHP License 2.02
|
|
|
32 |
* @version CVS: $Id: pearfrontendweb.php 278724 2009-04-15 04:05:42Z saltybeagle $
|
|
|
33 |
* @link http://pear.php.net/package/PEAR_Frontend_Web
|
|
|
34 |
* @since File available since Release 0.1
|
|
|
35 |
*/
|
|
|
36 |
|
|
|
37 |
/**
|
|
|
38 |
* This is PEAR_Frontend_Web
|
|
|
39 |
*/
|
|
|
40 |
define('PEAR_Frontend_Web',1);
|
|
|
41 |
@session_start();
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* base frontend class
|
|
|
45 |
*/
|
|
|
46 |
require_once 'PEAR.php';
|
|
|
47 |
require_once 'PEAR/Config.php';
|
|
|
48 |
require_once 'PEAR/Frontend.php';
|
|
|
49 |
require_once 'PEAR/Command.php';
|
|
|
50 |
|
|
|
51 |
// for the open_basedir prisoners, don't allow PEAR to search for a temp dir (would use /tmp), see bug #13167
|
|
|
52 |
putenv('TMPDIR='.dirname(__FILE__).'/temp');
|
|
|
53 |
|
|
|
54 |
// set $pear_user_config if it isn't set yet
|
|
|
55 |
// finds an existing file, or proposes the default location
|
|
|
56 |
if (!isset($pear_user_config) || $pear_user_config == '') {
|
|
|
57 |
if (OS_WINDOWS) {
|
|
|
58 |
$conf_name = 'pear.ini';
|
|
|
59 |
} else {
|
|
|
60 |
$conf_name = 'pear.conf';
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
// default backup config: the one from the installer (if available).
|
|
|
64 |
$install_config = '@pear_install_config@'; // filled in on install
|
|
|
65 |
// TODO: doesn't work yet ! There is no way to find the system config
|
|
|
66 |
if (file_exists($install_config)) {
|
|
|
67 |
$pear_user_config = $install_config;
|
|
|
68 |
} else {
|
|
|
69 |
|
|
|
70 |
// find other config file location
|
|
|
71 |
$default_config_dirs = array(
|
|
|
72 |
substr(dirname(__FILE__), 0, strrpos(dirname(__FILE__), DIRECTORY_SEPARATOR)), // strip eg PEAR from .../example/PEAR(/pearfrontendweb.php)
|
|
|
73 |
dirname($_SERVER['SCRIPT_FILENAME']),
|
|
|
74 |
PEAR_CONFIG_SYSCONFDIR,
|
|
|
75 |
);
|
|
|
76 |
// set the default: __FILE__ without PEAR/
|
|
|
77 |
$pear_user_config = $default_config_dirs[0].DIRECTORY_SEPARATOR.$conf_name;
|
|
|
78 |
|
|
|
79 |
$found = false;
|
|
|
80 |
foreach ($default_config_dirs as $confdir) {
|
|
|
81 |
if (file_exists($confdir.DIRECTORY_SEPARATOR.$conf_name)) {
|
|
|
82 |
$pear_user_config = $confdir.DIRECTORY_SEPARATOR.$conf_name;
|
|
|
83 |
$found = true;
|
|
|
84 |
break;
|
|
|
85 |
}
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
if (!$found) {
|
|
|
89 |
print('<p><b>Warning:</b> Can not find config file, please specify the $pear_user_config variable in '.$_SERVER['PHP_SELF'].'</p>');
|
|
|
90 |
}
|
|
|
91 |
}
|
|
|
92 |
unset($conf_name, $default_config_dirs, $confdir);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
require_once 'PEAR/Registry.php';
|
|
|
96 |
require_once 'PEAR/Config.php';
|
|
|
97 |
|
|
|
98 |
// moving this here allows startup messages and errors to work properly
|
|
|
99 |
PEAR_Frontend::setFrontendClass('PEAR_Frontend_Web');
|
|
|
100 |
// Init PEAR Installer Code and WebFrontend
|
|
|
101 |
$GLOBALS['_PEAR_Frontend_Web_config'] = &PEAR_Config::singleton($pear_user_config, '');
|
|
|
102 |
$config = &$GLOBALS['_PEAR_Frontend_Web_config'];
|
|
|
103 |
if (PEAR::isError($config)) {
|
|
|
104 |
die('<b>Error:</b> '.$config->getMessage());
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
$ui = &PEAR_Command::getFrontendObject();
|
|
|
108 |
if (PEAR::isError($ui)) {
|
|
|
109 |
die('<b>Error:</b> '.$ui->getMessage());
|
|
|
110 |
}
|
|
|
111 |
$ui->setConfig($config);
|
|
|
112 |
|
|
|
113 |
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, array($ui, "displayFatalError"));
|
|
|
114 |
|
|
|
115 |
// Cient requests an Image/Stylesheet/Javascript
|
|
|
116 |
// outputFrontendFile() does exit()
|
|
|
117 |
if (isset($_GET["css"])) {
|
|
|
118 |
$ui->outputFrontendFile($_GET["css"], 'css');
|
|
|
119 |
}
|
|
|
120 |
if (isset($_GET["js"])) {
|
|
|
121 |
$ui->outputFrontendFile($_GET["js"], 'js');
|
|
|
122 |
}
|
|
|
123 |
if (isset($_GET["img"])) {
|
|
|
124 |
$ui->outputFrontendFile($_GET["img"], 'image');
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
$verbose = $config->get("verbose");
|
|
|
128 |
$cmdopts = array();
|
|
|
129 |
$opts = array();
|
|
|
130 |
$params = array();
|
|
|
131 |
|
|
|
132 |
// create $pear_user_config if it doesn't exit yet
|
|
|
133 |
if (!file_exists($pear_user_config)) {
|
|
|
134 |
// I think PEAR_Frontend_Web is running for the first time!
|
|
|
135 |
// Create config and install it properly ...
|
|
|
136 |
$ui->outputBegin(null);
|
|
|
137 |
print('<h3>Preparing PEAR_Frontend_Web for its first time use...</h3>');
|
|
|
138 |
|
|
|
139 |
// find pear_dir:
|
|
|
140 |
if (!isset($pear_dir) || !file_exists($pear_dir)) {
|
|
|
141 |
// __FILE__ is eg .../example/PEAR/pearfrontendweb.php
|
|
|
142 |
$pear_dir = dirname(__FILE__); // eg .../example/PEAR
|
|
|
143 |
}
|
|
|
144 |
if (substr($pear_dir, -1) == DIRECTORY_SEPARATOR) {
|
|
|
145 |
$pear_dir = substr($pear_dir, 0, -1); // strip trailing /
|
|
|
146 |
}
|
|
|
147 |
// extract base_dir from pear_dir
|
|
|
148 |
$dir = substr($pear_dir, 0, strrpos($pear_dir, DIRECTORY_SEPARATOR)); // eg .../example
|
|
|
149 |
|
|
|
150 |
$dir .= DIRECTORY_SEPARATOR;
|
|
|
151 |
if (!is_dir($dir)) {
|
|
|
152 |
PEAR::raiseError('Can not find a base installation directory of PEAR ('.$dir.' doesn\'t work), so we can\'t create a config for it. Please supply it in the variable \'$pear_dir\'. The $pear_dir must have at least the subdirectory PEAR/ and be writable by this frontend.');
|
|
|
153 |
die();
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
print('Saving config file ('.$pear_user_config.')...');
|
|
|
157 |
// First of all set some config-vars:
|
|
|
158 |
// Tries to be compatible with go-pear
|
|
|
159 |
if (!isset($pear_dir)) {
|
|
|
160 |
$pear_dir = $dir.'PEAR'; // default (go-pear compatible)
|
|
|
161 |
}
|
|
|
162 |
$cmd = PEAR_Command::factory('config-set', $config);
|
|
|
163 |
$ok = $cmd->run('config-set', array(), array('php_dir', $pear_dir));
|
|
|
164 |
$ok = $cmd->run('config-set', array(), array('doc_dir', $pear_dir.'/docs'));
|
|
|
165 |
$ok = $cmd->run('config-set', array(), array('ext_dir', $dir.'ext'));
|
|
|
166 |
$ok = $cmd->run('config-set', array(), array('bin_dir', $dir.'bin'));
|
|
|
167 |
$ok = $cmd->run('config-set', array(), array('data_dir', $pear_dir.'/data'));
|
|
|
168 |
$ok = $cmd->run('config-set', array(), array('test_dir', $pear_dir.'/test'));
|
|
|
169 |
$ok = $cmd->run('config-set', array(), array('temp_dir', $dir.'temp'));
|
|
|
170 |
$ok = $cmd->run('config-set', array(), array('download_dir', $dir.'temp/download'));
|
|
|
171 |
$ok = $cmd->run('config-set', array(), array('cache_dir', $pear_dir.'/cache'));
|
|
|
172 |
$ok = $cmd->run('config-set', array(), array('cache_ttl', 300));
|
|
|
173 |
$ok = $cmd->run('config-set', array(), array('default_channel', 'pear.php.net'));
|
|
|
174 |
$ok = $cmd->run('config-set', array(), array('preferred_mirror', 'pear.php.net'));
|
|
|
175 |
|
|
|
176 |
print('Checking package registry...');
|
|
|
177 |
// Register packages
|
|
|
178 |
$packages = array(
|
|
|
179 |
'Archive_Tar',
|
|
|
180 |
'Console_Getopt',
|
|
|
181 |
'HTML_Template_IT',
|
|
|
182 |
'PEAR',
|
|
|
183 |
'PEAR_Frontend_Web',
|
|
|
184 |
'Structures_Graph'
|
|
|
185 |
);
|
|
|
186 |
$reg = &$config->getRegistry();
|
|
|
187 |
if (!file_exists($pear_dir.'/.registry')) {
|
|
|
188 |
PEAR::raiseError('Directory "'.$pear_dir.'/.registry" does not exist. please check your installation');
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
foreach($packages as $pkg) {
|
|
|
192 |
$info = $reg->packageInfo($pkg);
|
|
|
193 |
foreach($info['filelist'] as $fileName => $fileInfo) {
|
|
|
194 |
if($fileInfo['role'] == "php") {
|
|
|
195 |
$info['filelist'][$fileName]['installed_as'] =
|
|
|
196 |
str_replace('{dir}',$dir, $fileInfo['installed_as']);
|
|
|
197 |
}
|
|
|
198 |
}
|
|
|
199 |
$reg->updatePackage($pkg, $info, false);
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
print('<p><em>PEAR_Frontend_Web configured succesfully !</em></p>');
|
|
|
203 |
$msg = sprintf('<p><a href="%s">Click here to continue</a></p>',
|
|
|
204 |
$_SERVER['PHP_SELF']);
|
|
|
205 |
print($msg);
|
|
|
206 |
$ui->outputEnd(null);
|
|
|
207 |
die();
|
|
|
208 |
}
|
|
|
209 |
|
|
|
210 |
// Check _isProtected() override (disables the 'not protected' warning)
|
|
|
211 |
if (isset($pear_frontweb_protected) && $pear_frontweb_protected === true) {
|
|
|
212 |
$GLOBALS['_PEAR_Frontend_Web_protected'] = true;
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
$cache_dir = $config->get('cache_dir');
|
|
|
216 |
if (!is_dir($cache_dir)) {
|
|
|
217 |
include_once 'System.php';
|
|
|
218 |
if (!System::mkDir('-p', $cache_dir)) {
|
|
|
219 |
PEAR::raiseError('Directory "'.$cache_dir.'" does not exist and cannot be created. Please check your installation');
|
|
|
220 |
}
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
if (isset($_GET['command']) && !is_null($_GET['command'])) {
|
|
|
224 |
$command = $_GET['command'];
|
|
|
225 |
} else {
|
|
|
226 |
$command = 'list';
|
|
|
227 |
}
|
|
|
228 |
|
|
|
229 |
// Prepare and begin output
|
|
|
230 |
$ui->outputBegin($command);
|
|
|
231 |
|
|
|
232 |
// Handle some different Commands
|
|
|
233 |
switch ($command) {
|
|
|
234 |
case 'install':
|
|
|
235 |
case 'uninstall':
|
|
|
236 |
case 'upgrade':
|
|
|
237 |
if ($_GET['command'] == 'install') {
|
|
|
238 |
// also install dependencies
|
|
|
239 |
$opts['onlyreqdeps'] = true;
|
|
|
240 |
if (isset($_GET['force']) && $_GET['force'] == 'on') {
|
|
|
241 |
$opts['force'] = true;
|
|
|
242 |
}
|
|
|
243 |
}
|
|
|
244 |
|
|
|
245 |
if (strpos($_GET['pkg'], '\\\\') !== false) {
|
|
|
246 |
$_GET['pkg'] = stripslashes($_GET['pkg']);
|
|
|
247 |
}
|
|
|
248 |
$params = array($_GET["pkg"]);
|
|
|
249 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
250 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
251 |
|
|
|
252 |
$reg = &$config->getRegistry();
|
|
|
253 |
PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);
|
|
|
254 |
$err = $reg->parsePackageName($_GET['pkg']);
|
|
|
255 |
PEAR::staticPopErrorHandling(); // reset error handling
|
|
|
256 |
|
|
|
257 |
if (!PEAR::isError($err)) {
|
|
|
258 |
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=info&pkg='.$_GET['pkg'],
|
|
|
259 |
'text' => 'View package information'));
|
|
|
260 |
}
|
|
|
261 |
break;
|
|
|
262 |
case 'run-scripts' :
|
|
|
263 |
$params = array($_GET['pkg']);
|
|
|
264 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
265 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
266 |
break;
|
|
|
267 |
case 'info':
|
|
|
268 |
case 'remote-info':
|
|
|
269 |
$reg = &$config->getRegistry();
|
|
|
270 |
// we decide what it is:
|
|
|
271 |
$pkg = $reg->parsePackageName($_GET['pkg']);
|
|
|
272 |
if ($reg->packageExists($pkg['package'], $pkg['channel'])) {
|
|
|
273 |
$command = 'info';
|
|
|
274 |
} else {
|
|
|
275 |
$command = 'remote-info';
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
$params = array(strtolower($_GET['pkg']));
|
|
|
279 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
280 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
281 |
|
|
|
282 |
break;
|
|
|
283 |
case 'search':
|
|
|
284 |
if (!isset($_POST['search']) || $_POST['search'] == '') {
|
|
|
285 |
// unsubmited, show forms
|
|
|
286 |
$ui->outputSearch();
|
|
|
287 |
} else {
|
|
|
288 |
if ($_POST['channel'] == 'all') {
|
|
|
289 |
$opts['allchannels'] = true;
|
|
|
290 |
} else {
|
|
|
291 |
$opts['channel'] = $_POST['channel'];
|
|
|
292 |
}
|
|
|
293 |
$opts['channelinfo'] = true;
|
|
|
294 |
|
|
|
295 |
// submited, do search
|
|
|
296 |
switch ($_POST['search']) {
|
|
|
297 |
case 'name':
|
|
|
298 |
$params = array($_POST['input']);
|
|
|
299 |
break;
|
|
|
300 |
case 'description':
|
|
|
301 |
$params = array($_POST['input'], $_POST['input']);
|
|
|
302 |
break;
|
|
|
303 |
default:
|
|
|
304 |
PEAR::raiseError('Can\'t search for '.$_POST['search']);
|
|
|
305 |
break;
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
309 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
310 |
}
|
|
|
311 |
|
|
|
312 |
break;
|
|
|
313 |
case 'config-show':
|
|
|
314 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
315 |
$res = $cmd->run($command, $opts, $params);
|
|
|
316 |
|
|
|
317 |
// if this code is reached, the config vars are submitted
|
|
|
318 |
$set = PEAR_Command::factory('config-set', $config);
|
|
|
319 |
foreach($GLOBALS['_PEAR_Frontend_Web_Config'] as $var => $value) {
|
|
|
320 |
if ($var == 'Filename') {
|
|
|
321 |
continue; // I hate obscure bugs
|
|
|
322 |
}
|
|
|
323 |
if ($value != $config->get($var)) {
|
|
|
324 |
print('Saving '.$var.'... ');
|
|
|
325 |
$res = $set->run('config-set', $opts, array($var, $value));
|
|
|
326 |
$config->set($var, $value);
|
|
|
327 |
}
|
|
|
328 |
}
|
|
|
329 |
print('<p><b>Config saved succesfully!</b></p>');
|
|
|
330 |
|
|
|
331 |
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command='.$command, 'text' => 'Back to the config'));
|
|
|
332 |
break;
|
|
|
333 |
case 'list-files':
|
|
|
334 |
$params = array($_GET['pkg']);
|
|
|
335 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
336 |
$res = $cmd->run($command, $opts, $params);
|
|
|
337 |
break;
|
|
|
338 |
case 'list-docs':
|
|
|
339 |
if (!isset($_GET['pkg'])) {
|
|
|
340 |
PEAR::raiseError('The webfrontend-command list-docs needs at least one \'pkg\' argument.');
|
|
|
341 |
break;
|
|
|
342 |
}
|
|
|
343 |
|
|
|
344 |
require_once('PEAR/Frontend/Web/Docviewer.php');
|
|
|
345 |
$reg = $config->getRegistry();
|
|
|
346 |
$pkg = $reg->parsePackageName($_GET['pkg']);
|
|
|
347 |
|
|
|
348 |
$docview = new PEAR_Frontend_Web_Docviewer($ui);
|
|
|
349 |
$docview->outputListDocs($pkg['package'], $pkg['channel']);
|
|
|
350 |
break;
|
|
|
351 |
case 'doc-show':
|
|
|
352 |
if (!isset($_GET['pkg']) || !isset($_GET['file'])) {
|
|
|
353 |
PEAR::raiseError('The webfrontend-command list-docs needs one \'pkg\' and one \'file\' argument.');
|
|
|
354 |
break;
|
|
|
355 |
}
|
|
|
356 |
|
|
|
357 |
require_once('PEAR/Frontend/Web/Docviewer.php');
|
|
|
358 |
$reg = $config->getRegistry();
|
|
|
359 |
$pkg = $reg->parsePackageName($_GET['pkg']);
|
|
|
360 |
|
|
|
361 |
$docview = new PEAR_Frontend_Web_Docviewer($ui);
|
|
|
362 |
$docview->outputDocShow($pkg['package'], $pkg['channel'], $_GET['file']);
|
|
|
363 |
break;
|
|
|
364 |
case 'list-all':
|
|
|
365 |
// Deprecated, use 'list-categories' is used instead
|
|
|
366 |
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
|
|
367 |
$opts['channel'] = $_GET['chan'];
|
|
|
368 |
}
|
|
|
369 |
$opts['channelinfo'] = true;
|
|
|
370 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
371 |
$res = $cmd->run($command, $opts, $params);
|
|
|
372 |
|
|
|
373 |
break;
|
|
|
374 |
case 'list-categories':
|
|
|
375 |
case 'list-packages':
|
|
|
376 |
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
|
|
377 |
$opts['channel'] = $_GET['chan'];
|
|
|
378 |
} else {
|
|
|
379 |
// show 'table of contents' before all channel output
|
|
|
380 |
$ui->outputTableOfChannels();
|
|
|
381 |
|
|
|
382 |
$opts['allchannels'] = true;
|
|
|
383 |
}
|
|
|
384 |
if (isset($_GET['opt']) && $_GET['opt'] == 'packages') {
|
|
|
385 |
$opts['packages'] = true;
|
|
|
386 |
}
|
|
|
387 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
388 |
$res = $cmd->run($command, $opts, $params);
|
|
|
389 |
|
|
|
390 |
break;
|
|
|
391 |
case 'list-category':
|
|
|
392 |
if (isset($_GET['chan']) && $_GET['chan'] != '') {
|
|
|
393 |
$opts['channel'] = $_GET['chan'];
|
|
|
394 |
}
|
|
|
395 |
$params = array($_GET['cat']);
|
|
|
396 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
397 |
$res = $cmd->run($command, $opts, $params);
|
|
|
398 |
|
|
|
399 |
break;
|
|
|
400 |
case 'list':
|
|
|
401 |
$opts['allchannels'] = true;
|
|
|
402 |
$opts['channelinfo'] = true;
|
|
|
403 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
404 |
$res = $cmd->run($command, $opts, $params);
|
|
|
405 |
|
|
|
406 |
break;
|
|
|
407 |
case 'list-upgrades':
|
|
|
408 |
$opts['channelinfo'] = true;
|
|
|
409 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
410 |
$res = $cmd->run($command, $opts, $params);
|
|
|
411 |
$ui->outputUpgradeAll();
|
|
|
412 |
|
|
|
413 |
break;
|
|
|
414 |
case 'upgrade-all':
|
|
|
415 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
416 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
417 |
|
|
|
418 |
$ui->finishOutput('Back', array('link' => $_SERVER['PHP_SELF'].'?command=list',
|
|
|
419 |
'text' => 'Click here to go back'));
|
|
|
420 |
break;
|
|
|
421 |
case 'channel-info':
|
|
|
422 |
if (isset($_GET['chan']))
|
|
|
423 |
$params[] = $_GET['chan'];
|
|
|
424 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
425 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
426 |
|
|
|
427 |
break;
|
|
|
428 |
case 'channel-discover':
|
|
|
429 |
if (isset($_GET['chan']) && $_GET['chan'] != '')
|
|
|
430 |
$params[] = $_GET['chan'];
|
|
|
431 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
432 |
$ui->startSession();
|
|
|
433 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
434 |
|
|
|
435 |
$ui->finishOutput('Channel Discovery', array('link' =>
|
|
|
436 |
$_SERVER['PHP_SELF'] . '?command=channel-info&chan=' . urlencode($_GET['chan']),
|
|
|
437 |
'text' => 'Click Here for ' . htmlspecialchars($_GET['chan']) . ' Information'));
|
|
|
438 |
break;
|
|
|
439 |
case 'channel-delete':
|
|
|
440 |
if (isset($_GET["chan"]))
|
|
|
441 |
$params[] = $_GET["chan"];
|
|
|
442 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
443 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
444 |
|
|
|
445 |
$ui->finishOutput('Delete Channel', array('link' =>
|
|
|
446 |
$_SERVER['PHP_SELF'] . '?command=list-channels',
|
|
|
447 |
'text' => 'Click here to list all channels'));
|
|
|
448 |
break;
|
|
|
449 |
case 'list-channels':
|
|
|
450 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
451 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
452 |
|
|
|
453 |
break;
|
|
|
454 |
case 'channel-update':
|
|
|
455 |
if (isset($_GET['chan'])) {
|
|
|
456 |
$params = array($_GET['chan']);
|
|
|
457 |
}
|
|
|
458 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
459 |
$ok = $cmd->run($command, $opts, $params);
|
|
|
460 |
|
|
|
461 |
break;
|
|
|
462 |
case 'update-channels':
|
|
|
463 |
// update every channel manually,
|
|
|
464 |
// fixes bug PEAR/#10275 (XML_RPC dependency)
|
|
|
465 |
// will be fixed in next pear release
|
|
|
466 |
$reg = &$config->getRegistry();
|
|
|
467 |
$channels = $reg->getChannels();
|
|
|
468 |
$command = 'channel-update';
|
|
|
469 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
470 |
|
|
|
471 |
$success = true;
|
|
|
472 |
$ui->startSession();
|
|
|
473 |
foreach ($channels as $channel) {
|
|
|
474 |
if ($channel->getName() != '__uri') {
|
|
|
475 |
$success &= $cmd->run($command, $opts,
|
|
|
476 |
array($channel->getName()));
|
|
|
477 |
}
|
|
|
478 |
}
|
|
|
479 |
|
|
|
480 |
$ui->finishOutput('Update Channel List', array('link' =>
|
|
|
481 |
$_SERVER['PHP_SELF'] . '?command=list-channels',
|
|
|
482 |
'text' => 'Click here to list all channels'));
|
|
|
483 |
break;
|
|
|
484 |
default:
|
|
|
485 |
$cmd = PEAR_Command::factory($command, $config);
|
|
|
486 |
$res = $cmd->run($command, $opts, $params);
|
|
|
487 |
|
|
|
488 |
break;
|
|
|
489 |
}
|
|
|
490 |
|
|
|
491 |
$ui->outputEnd($command);
|
|
|
492 |
|
|
|
493 |
?>
|