Source for file WebInstaller.php
Documentation is available at WebInstaller.php
+----------------------------------------------------------------------+
+----------------------------------------------------------------------+
| Copyright (c) 1997-2003 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Christian Dickmann <dickmann@php.net> |
| Pierre-Alain Joye <pajoye@php.net> |
+----------------------------------------------------------------------+
$Id: WebInstaller.php,v 1.29 2004/05/25 20:59:36 pajoye Exp $
define('PEAR_Frontend_Web',1 );
if (!isset ($_SESSION['_PEAR_Frontend_Web_js'])) {
$_SESSION['_PEAR_Frontend_Web_js'] = false;
if (isset ($_GET['enableJS']) && $_GET['enableJS'] == 1 ) {
$_SESSION['_PEAR_Frontend_Web_js'] = true;
define('USE_DHTML_PROGRESS', (@$useDHTML && $_SESSION['_PEAR_Frontend_Web_js']));
if (!isset ($pear_user_config)) {
$pear_user_config = dirname(__FILE__ ). "/pear.conf";
require_once 'PEAR/Registry.php';
require_once 'PEAR/Config.php';
require_once 'PEAR/Command.php';
// Init PEAR Installer Code and WebFrontend
$config = $GLOBALS['_PEAR_Frontend_Web_config'] = &PEAR_Config ::singleton ($pear_user_config, '');
PEAR_Command ::setFrontendType ("Web");
$ui = &PEAR_Command ::getFrontendObject ();
PEAR ::setErrorHandling (PEAR_ERROR_CALLBACK , array ($ui, "displayFatalError"));
// Cient requests an Image/Stylesheet/Javascript
if (isset ($_GET["css"])) {
$ui->outputFrontendFile ($_GET["css"], 'css');
if (isset ($_GET["js"])) {
$ui->outputFrontendFile ($_GET["js"], 'js');
if (isset ($_GET["img"])) {
$ui->outputFrontendFile ($_GET["img"], 'image');
$verbose = $config->get ("verbose");
$URL = 'http://'. $_SERVER['HTTP_HOST']. $_SERVER['PHP_SELF'];
$_ENV['TMPDIR'] = $_ENV['TEMP'] = $dir. 'tmp';
// I think PEAR_Frontend_Web is running for the first time!
// Install it properly ...
// First of all set some config-vars:
$cmd = PEAR_Command ::factory ('config-set', $config);
$ok = $cmd->run ('config-set', array (), array ('php_dir', $dir. 'PEAR'));
$ok = $cmd->run ('config-set', array (), array ('doc_dir', $dir. 'docs'));
$ok = $cmd->run ('config-set', array (), array ('ext_dir', $dir. 'ext'));
$ok = $cmd->run ('config-set', array (), array ('bin_dir', $dir. 'bin'));
$ok = $cmd->run ('config-set', array (), array ('data_dir', $dir. 'data'));
$ok = $cmd->run ('config-set', array (), array ('test_dir', $dir. 'test'));
$ok = $cmd->run ('config-set', array (), array ('cache_dir', $dir. 'cache'));
$ok = $cmd->run ('config-set', array (), array ('cache_ttl', 300 ));
$reg = new PEAR_Registry ($dir. 'PEAR');
PEAR ::raiseError ('Directory "'. $dir. 'PEAR/.registry" does not exist. please check your installation');
foreach($packages as $pkg) {
$info = $reg->packageInfo ($pkg);
foreach($info['filelist'] as $fileName => $fileInfo) {
if($fileInfo['role'] == "php") {
$info['filelist'][$fileName]['installed_as'] =
$reg->updatePackage ($pkg, $info, false );
// Handle some diffrent Commands
if (isset ($_GET["command"])) {
switch ($_GET["command"]) {
PEAR ::setErrorHandling (PEAR_ERROR_CALLBACK , array ($ui, "displayErrorImg"));
$command = $_GET["command"];
$params = array ($_GET["pkg"]);
$cmd = PEAR_Command ::factory ($command, $config);
$ok = $cmd->run ($command, $opts, $params);
echo '<script language="javascript">';
if ($_GET["command"] == "uninstall") {
printf(' parent.deleteVersion(\'%s\'); ', $_GET["pkg"]);
printf(' parent.displayInstall(\'%s\'); ', $_GET["pkg"]);
printf(' parent.hideDelete(\'%s\'); ', $_GET["pkg"]);
printf(' parent.newestVersion(\'%s\'); ', $_GET["pkg"]);
printf(' parent.hideInstall(\'%s\'); ', $_GET["pkg"]);
printf(' parent.displayDelete(\'%s\'); ', $_GET["pkg"]);
$html = sprintf('<img src="%s?img=install_ok" border="0">', $_SERVER['PHP_SELF']);
if (isset ($_GET['redirect']) && $_GET['redirect'] == 'info') {
$URL .= '?command=remote-info&pkg='. $_GET["pkg"];
} elseif (isset ($_GET['redirect']) && $_GET['redirect'] == 'search') {
$URL .= '?command=search&userDialogResult=get&0='. $_GET["0"]. '&1='. $_GET["1"];
$URL .= '?command=list-all&pageID='. $_GET['pageID']. '#'. $_GET["pkg"];
Header ("Location: ". $URL);
$command = $_GET["command"];
$params = array ($_GET["pkg"]);
$cmd = PEAR_Command ::factory ($command, $config);
$ok = $cmd->run ($command, $opts, $params);
list ($name, $description) = $ui->userDialog ('search',
array ('Package Name', 'Package Info'), // Prompts
array (), array (), // Types, Defaults
'Package Search', 'pkgsearch' // Title, Icon
$command = $_GET["command"];
$params = array ($name, $description);
$cmd = PEAR_Command ::factory ($command, $config);
$ok = $cmd->run ($command, $opts, $params);
$command = $_GET["command"];
$cmd = PEAR_Command ::factory ($command, $config);
$res = $cmd->run ($command, $opts, $params);
foreach($GLOBALS['_PEAR_Frontend_Web_Config'] as $var => $value) {
$params = array ($var, $value);
$cmd = PEAR_Command ::factory ($command, $config);
$res = $cmd->run ($command, $opts, $params);
$URL .= '?command=config-show';
$command = $_GET["command"];
if (isset ($_GET["mode"]))
$opts['mode'] = $_GET["mode"];
$cmd = PEAR_Command ::factory ($command, $config);
$ok = $cmd->run ($command, $opts, $params);
$GLOBALS['_PEAR_Frontend_Web_log'] = $_SESSION['_PEAR_Frontend_Web_LastError_log'];
$ui->displayError ($_SESSION['_PEAR_Frontend_Web_LastError'], 'Error', 'error', true );
$command = $_GET["command"];
$cmd = PEAR_Command ::factory ($command, $config);
$res = $cmd->run ($command, $opts, $params);
$URL .= '?command='. $_GET["command"];
Documentation generated on Mon, 11 Mar 2019 10:17:18 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|