<?php
 $GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI'; $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null; class PEAR_Frontend extends PEAR { function &singleton($type = null) { if ($type === null) { if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) { $a = false; return $a; } return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } $a = PEAR_Frontend::setFrontendClass($type); return $a; } function &setFrontendClass($uiclass) { if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) { return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } if (!class_exists($uiclass)) { $file = str_replace('_', '/', $uiclass) . '.php'; if (PEAR_Frontend::isIncludeable($file)) { include_once $file; } } if (class_exists($uiclass)) { $obj = &new $uiclass; if (is_a($obj, 'PEAR_Frontend')) { $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj; $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass; return $obj; } $err = PEAR::raiseError("not a frontend class: $uiclass"); return $err; } $err = PEAR::raiseError("no such class: $uiclass"); return $err; } function &setFrontendObject($uiobject) { if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) && is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) { return $GLOBALS['_PEAR_FRONTEND_SINGLETON']; } if (!is_a($uiobject, 'PEAR_Frontend')) { $err = PEAR::raiseError('not a valid frontend class: (' . get_class($uiobject) . ')'); return $err; } $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject; $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject); return $uiobject; } function isIncludeable($path) { if (file_exists($path) && is_readable($path)) { return true; } $fp = @fopen($path, 'r', true); if ($fp) { fclose($fp); return true; } return false; } function setConfig(&$config) { } function addTempFile($file) { $GLOBALS['_PEAR_Common_tempfiles'][] = $file; } function log($msg, $append_crlf = true) { } function runPostinstallScripts(&$scripts) { } function outputData($data, $command = '_default') { } function userDialog($command, $prompts, $types = array(), $defaults = array()) { } }