2001-04-17 01:17:59 +00:00
|
|
|
#!@prefix@/bin/php -Cq
|
2001-10-31 05:39:11 +00:00
|
|
|
<?php // -*- PHP -*-
|
2001-05-22 16:21:02 +00:00
|
|
|
//
|
|
|
|
// +----------------------------------------------------------------------+
|
2001-12-11 15:32:16 +00:00
|
|
|
// | PHP Version 4 |
|
2001-05-22 16:21:02 +00:00
|
|
|
// +----------------------------------------------------------------------+
|
2001-12-11 15:32:16 +00:00
|
|
|
// | Copyright (c) 1997-2002 The PHP Group |
|
2001-05-22 16:21:02 +00:00
|
|
|
// +----------------------------------------------------------------------+
|
|
|
|
// | 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. |
|
|
|
|
// +----------------------------------------------------------------------+
|
|
|
|
// | Authors: Stig Bakken <ssb@fast.no> |
|
|
|
|
// | Tomas V.V.Cox <cox@idecnet.com> |
|
|
|
|
// +----------------------------------------------------------------------+
|
|
|
|
//
|
2001-11-13 01:07:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
command structure:
|
|
|
|
|
|
|
|
* remote queries:
|
|
|
|
** list available packages
|
|
|
|
** list not-installed packages
|
|
|
|
** list upgrades
|
|
|
|
|
2001-12-12 01:35:03 +00:00
|
|
|
** list packages (by author/category/state)
|
2001-11-13 01:07:36 +00:00
|
|
|
|
|
|
|
* operations on package files:
|
|
|
|
|
|
|
|
* installation commands:
|
|
|
|
|
|
|
|
* package generation commands:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
2001-05-22 16:21:02 +00:00
|
|
|
require_once 'PEAR.php';
|
2001-10-31 05:39:11 +00:00
|
|
|
require_once 'PEAR/Common.php';
|
2001-10-26 10:07:43 +00:00
|
|
|
require_once 'PEAR/Config.php';
|
2001-10-28 23:22:17 +00:00
|
|
|
require_once 'PEAR/Remote.php';
|
2001-10-29 14:15:43 +00:00
|
|
|
require_once 'PEAR/Registry.php';
|
2001-05-22 16:21:02 +00:00
|
|
|
require_once 'Console/Getopt.php';
|
2000-07-17 22:52:08 +00:00
|
|
|
|
2001-12-11 08:39:56 +00:00
|
|
|
error_reporting(E_ALL & ~E_NOTICE);
|
2000-07-17 22:52:08 +00:00
|
|
|
|
2001-10-27 07:52:12 +00:00
|
|
|
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "pear: %s\n");
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// {{{ config file and option parsing
|
2001-10-31 05:39:11 +00:00
|
|
|
$options = Console_Getopt::getopt($argv, "c:C:d:D:h?sSqu:v");
|
2001-04-17 01:17:59 +00:00
|
|
|
if (PEAR::isError($options)) {
|
|
|
|
usage($options);
|
2000-07-17 22:52:08 +00:00
|
|
|
}
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
if (OS_WINDOWS) {
|
|
|
|
$pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pearsys.ini';
|
2001-12-11 20:52:58 +00:00
|
|
|
$pear_user_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.ini';
|
2001-10-26 10:07:43 +00:00
|
|
|
} else {
|
|
|
|
$pear_default_config = PHP_SYSCONFDIR.DIRECTORY_SEPARATOR.'pear.conf';
|
2001-12-11 20:52:58 +00:00
|
|
|
$pear_user_config = getenv('HOME').DIRECTORY_SEPARATOR.'.pearrc';
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
|
|
|
|
2001-05-22 16:21:02 +00:00
|
|
|
$opts = $options[0];
|
2001-10-26 10:07:43 +00:00
|
|
|
|
|
|
|
foreach ($opts as $opt) {
|
|
|
|
switch ($opt[0]) {
|
|
|
|
case 'c':
|
|
|
|
$pear_user_config = $opt[1];
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
$pear_default_config = $opt[1];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$config = new PEAR_Config($pear_user_config, $pear_default_config);
|
|
|
|
$store_user_config = false;
|
|
|
|
$store_default_config = false;
|
2001-11-15 01:24:35 +00:00
|
|
|
$verbose = 1;
|
2001-10-26 10:07:43 +00:00
|
|
|
|
2001-05-22 16:21:02 +00:00
|
|
|
foreach ($opts as $opt) {
|
|
|
|
$param = $opt[1];
|
|
|
|
switch ($opt[0]) {
|
2001-10-26 10:07:43 +00:00
|
|
|
case 'd':
|
|
|
|
list($key, $value) = explode('=', $param);
|
|
|
|
$config->set($key, $value);
|
2001-05-22 16:21:02 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
case 'D':
|
|
|
|
list($key, $value) = explode('=', $param);
|
|
|
|
$config->set($key, $value, true);
|
2001-05-22 16:21:02 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
case 's':
|
|
|
|
$store_user_config = true;
|
2001-05-22 16:21:02 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
case 'S':
|
|
|
|
$store_default_config = true;
|
2001-05-22 16:21:02 +00:00
|
|
|
break;
|
2001-10-31 05:39:11 +00:00
|
|
|
case 'u':
|
|
|
|
$config->toDefault($param);
|
|
|
|
break;
|
2001-10-29 14:15:43 +00:00
|
|
|
case 'v':
|
|
|
|
$verbose++;
|
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
$verbose--;
|
|
|
|
break;
|
2001-05-22 16:21:02 +00:00
|
|
|
}
|
|
|
|
}
|
2001-04-17 01:17:59 +00:00
|
|
|
|
2001-10-27 07:52:12 +00:00
|
|
|
if ($store_default_config) {
|
|
|
|
if (@is_writeable($pear_default_config)) {
|
|
|
|
$config->writeConfigFile($pear_default_config, 'default');
|
|
|
|
} else {
|
|
|
|
die("You don't have write access to $pear_default_config, exiting!\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($store_user_config) {
|
|
|
|
$config->writeConfigFile($pear_user_config, 'userdefined');
|
|
|
|
}
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
$fallback_config = array(
|
2001-10-31 05:39:11 +00:00
|
|
|
'master_server' => 'pear.php.net',
|
|
|
|
'php_dir' => PEAR_INSTALL_DIR,
|
|
|
|
'ext_dir' => PEAR_EXTENSION_DIR,
|
2001-12-26 04:00:30 +00:00
|
|
|
'doc_dir' => PHP_DATADIR . DIRECTORY_SEPARATOR . 'pear' .
|
|
|
|
DIRECTORY_SEPARATOR . 'doc',
|
2001-10-31 05:39:11 +00:00
|
|
|
'verbose' => true,
|
2001-10-26 10:07:43 +00:00
|
|
|
);
|
2001-10-31 05:39:11 +00:00
|
|
|
$fallback_done = array();
|
2001-10-26 10:07:43 +00:00
|
|
|
|
|
|
|
foreach ($fallback_config as $key => $value) {
|
|
|
|
if (!$config->isDefined($key)) {
|
|
|
|
$config->set($key, $value);
|
2001-10-31 05:39:11 +00:00
|
|
|
$fallback_done[$key] = true;
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-07 09:25:39 +00:00
|
|
|
//$verbose = $config->get("verbose");
|
2001-10-26 10:07:43 +00:00
|
|
|
$script_dir = $config->get("php_dir");
|
|
|
|
$ext_dir = $config->get("ext_dir");
|
|
|
|
$doc_dir = $config->get("doc_dir");
|
|
|
|
|
2001-11-06 01:05:28 +00:00
|
|
|
$command = (isset($options[1][1])) ? $options[1][1] : null;
|
2001-10-29 14:15:43 +00:00
|
|
|
$rest = array_slice($options[1], 2);
|
|
|
|
|
|
|
|
$command_options = array(
|
2001-12-11 08:39:56 +00:00
|
|
|
"list-installed" => "v",
|
2001-12-12 01:35:03 +00:00
|
|
|
"install" => "fr",
|
|
|
|
"uninstall" => "fr",
|
|
|
|
"upgrade" => "fr",
|
2001-10-29 14:15:43 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (isset($command_options[$command])) {
|
|
|
|
$tmp = Console_Getopt::getopt($rest, $command_options[$command]);
|
|
|
|
if (PEAR::isError($tmp)) {
|
|
|
|
usage($tmp);
|
|
|
|
}
|
2001-12-11 08:39:56 +00:00
|
|
|
$cmdopts = $tmp[0];
|
2001-10-29 14:15:43 +00:00
|
|
|
$cmdargs = $tmp[1];
|
|
|
|
} else {
|
2001-12-11 08:39:56 +00:00
|
|
|
$cmdopts = array();
|
2001-10-29 14:15:43 +00:00
|
|
|
$cmdargs = $rest;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// }}}
|
|
|
|
|
2001-04-17 01:17:59 +00:00
|
|
|
switch ($command) {
|
2001-12-18 08:48:28 +00:00
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// {{{ install
|
|
|
|
|
2001-12-12 01:35:03 +00:00
|
|
|
case 'install': case 'upgrade': {
|
2001-07-17 20:46:16 +00:00
|
|
|
include_once 'PEAR/Installer.php';
|
2001-12-11 08:39:56 +00:00
|
|
|
$pkgfile = $cmdargs[0];
|
2001-05-22 16:21:02 +00:00
|
|
|
$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
|
2001-11-07 09:25:39 +00:00
|
|
|
$installer->setErrorHandling(PEAR_ERROR_DIE,
|
|
|
|
basename($pkgfile) . ": %s\n");
|
2001-05-22 16:21:02 +00:00
|
|
|
$installer->debug = $verbose;
|
2001-12-11 08:39:56 +00:00
|
|
|
$install_options = array();
|
2001-12-12 01:35:03 +00:00
|
|
|
if ($command == 'upgrade') {
|
|
|
|
$install_options['upgrade'] = true;
|
|
|
|
}
|
2001-12-11 08:39:56 +00:00
|
|
|
foreach ($cmdopts as $opt) {
|
2001-12-12 01:35:03 +00:00
|
|
|
switch ($opt[0]) {
|
|
|
|
case 'r':
|
|
|
|
// This option is for use by rpm and other package
|
|
|
|
// tools that can install files etc. by itself, but
|
|
|
|
// still needs to register the package as installed in
|
|
|
|
// PEAR's local registry.
|
|
|
|
$install_options['register_only'] = true;
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
$install_options['force'] = true;
|
|
|
|
break;
|
2001-12-11 08:39:56 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-12 01:35:03 +00:00
|
|
|
if ($installer->install($pkgfile, $install_options)) {
|
|
|
|
print "install ok\n";
|
|
|
|
} else {
|
|
|
|
print "install failed\n";
|
|
|
|
}
|
2001-04-17 01:17:59 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
|
|
|
|
2001-11-15 01:24:35 +00:00
|
|
|
// }}}
|
|
|
|
// {{{ uninstall
|
|
|
|
case 'uninstall': {
|
|
|
|
include_once 'PEAR/Installer.php';
|
2001-12-11 08:39:56 +00:00
|
|
|
$pkgfile = $cmdargs[0];
|
2001-11-15 01:24:35 +00:00
|
|
|
$installer =& new PEAR_Installer($script_dir, $ext_dir, $doc_dir);
|
|
|
|
$installer->setErrorHandling(PEAR_ERROR_DIE,
|
|
|
|
basename($pkgfile) . ": %s\n");
|
|
|
|
$installer->debug = $verbose;
|
2001-12-11 08:39:56 +00:00
|
|
|
$uninstall_options = array();
|
|
|
|
foreach ($cmdopts as $opt) {
|
2001-12-12 01:35:03 +00:00
|
|
|
switch ($opt[0]) {
|
|
|
|
case 'r':
|
|
|
|
$uninstall_options['register_only'] = true;
|
|
|
|
break;
|
|
|
|
case 'f':
|
|
|
|
$uninstall_options['force'] = true;
|
|
|
|
break;
|
2001-12-11 08:39:56 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-12 01:35:03 +00:00
|
|
|
if ($installer->uninstall($pkgfile, $uninstall_options)) {
|
|
|
|
print "uninstall ok\n";
|
|
|
|
} else {
|
|
|
|
print "uninstall failed\n";
|
|
|
|
}
|
2001-11-15 01:24:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-10-26 10:07:43 +00:00
|
|
|
// }}}
|
|
|
|
// {{{ package
|
|
|
|
|
|
|
|
case 'package': {
|
2001-07-17 20:46:16 +00:00
|
|
|
include_once 'PEAR/Packager.php';
|
2001-12-11 08:39:56 +00:00
|
|
|
$pkginfofile = isset($cmdargs[0]) ? $cmdargs[0] : null;
|
2001-05-22 16:21:02 +00:00
|
|
|
$packager =& new PEAR_Packager($script_dir, $ext_dir, $doc_dir);
|
2001-10-31 05:39:11 +00:00
|
|
|
$packager->setErrorHandling(PEAR_ERROR_DIE, "pear page: %s\n");
|
2001-05-22 16:21:02 +00:00
|
|
|
$packager->debug = $verbose;
|
2001-04-17 02:33:45 +00:00
|
|
|
if (PEAR::isError($packager->Package($pkginfofile))) {
|
|
|
|
print "\npackage failed\n";
|
|
|
|
} else {
|
|
|
|
print "package ok\n";
|
|
|
|
}
|
2001-04-17 01:17:59 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
|
|
|
|
2001-10-31 05:39:11 +00:00
|
|
|
// }}}
|
|
|
|
// {{{ info
|
|
|
|
|
|
|
|
case 'info': {
|
|
|
|
$parser = new PEAR_Common;
|
|
|
|
$parser->setErrorHandling(PEAR_ERROR_DIE, "pear info: %s\n");
|
2001-12-11 08:39:56 +00:00
|
|
|
$info = $parser->infoFromTgzFile($cmdargs[0]);
|
2001-10-31 05:39:11 +00:00
|
|
|
unset($info['filelist']);
|
|
|
|
present_array($info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// }}}
|
2001-11-13 01:07:36 +00:00
|
|
|
// {{{ list-installed
|
2001-10-29 14:15:43 +00:00
|
|
|
|
2001-11-13 01:07:36 +00:00
|
|
|
case 'list-installed': {
|
2001-10-29 14:15:43 +00:00
|
|
|
$reg = new PEAR_Registry;
|
|
|
|
$installed = $reg->packageInfo();
|
|
|
|
$i = $j = 0;
|
2001-12-11 08:39:56 +00:00
|
|
|
heading("Installed packages:");
|
2001-10-29 14:15:43 +00:00
|
|
|
foreach ($installed as $package) {
|
|
|
|
if ($i++ % 20 == 0) {
|
|
|
|
if ($j++ > 0) {
|
|
|
|
print "\n";
|
|
|
|
}
|
2001-11-07 09:25:39 +00:00
|
|
|
printf("%-20s %-10s %s\n",
|
|
|
|
"Package", "Version", "State");
|
2001-11-13 01:07:36 +00:00
|
|
|
print str_repeat("-", 75)."\n";
|
2001-10-29 14:15:43 +00:00
|
|
|
}
|
2001-11-07 09:25:39 +00:00
|
|
|
printf("%-20s %-10s %s\n", $package['package'],
|
|
|
|
$package['version'], $package['release_state']);
|
2001-10-29 14:15:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// }}}
|
2001-11-13 01:07:36 +00:00
|
|
|
// {{{ list-available
|
2001-10-26 10:07:43 +00:00
|
|
|
|
2001-11-13 01:07:36 +00:00
|
|
|
case 'list-available': {
|
2001-10-26 10:07:43 +00:00
|
|
|
$remote = new PEAR_Remote($config);
|
2001-10-26 11:45:21 +00:00
|
|
|
$result = $remote->call('package.listAll');
|
|
|
|
$i = $j = 0;
|
2001-12-11 08:39:56 +00:00
|
|
|
heading("Available packages");
|
2001-10-26 11:45:21 +00:00
|
|
|
foreach ($result as $package) {
|
|
|
|
if ($i++ % 20 == 0) {
|
|
|
|
if ($j++ > 0) {
|
|
|
|
print "\n";
|
|
|
|
}
|
|
|
|
printf("%-20s %-10s %-15s %s\n",
|
|
|
|
"Package", "Stable", "Lead", "Category");
|
2001-11-13 01:07:36 +00:00
|
|
|
print str_repeat("-", 75)."\n";
|
2001-10-26 11:45:21 +00:00
|
|
|
}
|
|
|
|
$stable = $package['stable'];
|
|
|
|
printf("%-20s %-10s %-15s %s\n", $package['name'],
|
|
|
|
$stable ? $stable : "???",
|
|
|
|
$package['lead'], $package['category']);
|
|
|
|
}
|
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
|
|
|
|
2001-10-31 05:39:11 +00:00
|
|
|
// }}}
|
|
|
|
// {{{ show-config
|
|
|
|
|
|
|
|
case 'show-config': {
|
|
|
|
$keys = $config->getKeys();
|
|
|
|
foreach ($keys as $key) {
|
|
|
|
$value = $config->get($key);
|
|
|
|
$xi = "";
|
|
|
|
if ($config->isDefaulted($key)) {
|
|
|
|
$xi .= " (default)";
|
|
|
|
}
|
2001-12-11 08:39:56 +00:00
|
|
|
if (isset($fallback_done[$key])) {
|
|
|
|
$xi .= " (built-in)";
|
2001-10-31 05:39:11 +00:00
|
|
|
}
|
|
|
|
printf("%s = %s%s\n", $key, $value, $xi);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// }}}
|
|
|
|
default: {
|
|
|
|
if (!$store_default_config && !$store_user_config) {
|
|
|
|
usage();
|
|
|
|
}
|
2001-04-17 01:17:59 +00:00
|
|
|
break;
|
2001-10-26 10:07:43 +00:00
|
|
|
}
|
2001-04-17 01:17:59 +00:00
|
|
|
}
|
2000-07-24 23:55:34 +00:00
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// {{{ usage()
|
|
|
|
|
|
|
|
function usage($error = null)
|
2001-01-08 02:45:30 +00:00
|
|
|
{
|
2001-05-22 16:21:02 +00:00
|
|
|
$stderr = fopen('php://stderr', 'w');
|
2001-11-06 01:05:28 +00:00
|
|
|
if (PEAR::isError($error)) {
|
2001-10-26 10:07:43 +00:00
|
|
|
fputs($stderr, $error->getMessage());
|
2001-11-06 01:05:28 +00:00
|
|
|
} elseif ($error !== null) {
|
2001-10-26 10:07:43 +00:00
|
|
|
fputs($stderr, $error);
|
2001-04-17 01:17:59 +00:00
|
|
|
}
|
2001-01-08 02:45:30 +00:00
|
|
|
fputs($stderr,
|
2001-12-11 08:39:56 +00:00
|
|
|
"Usage: pear [options] command [command-options] <parameters>\n".
|
2001-01-08 02:45:30 +00:00
|
|
|
"Options:\n".
|
2001-10-29 14:15:43 +00:00
|
|
|
" -v increase verbosity level (default 1)\n".
|
|
|
|
" -q be quiet, decrease verbosity level\n".
|
|
|
|
" -c file find user configuration in `file'\n".
|
|
|
|
" -C file find system configuration in `file'\n".
|
|
|
|
" -d foo=bar set user config variable `foo' to `bar'\n".
|
|
|
|
" -D foo=bar set system config variable `foo' to `bar'\n".
|
|
|
|
" -s store user configuration\n".
|
|
|
|
" -s store system configuration\n".
|
2001-10-31 05:39:11 +00:00
|
|
|
" -u foo unset `foo' in the user configuration\n".
|
2001-10-29 14:15:43 +00:00
|
|
|
" -h, -? display help/usage (this message)\n".
|
2001-04-17 01:17:59 +00:00
|
|
|
"Commands:\n".
|
2001-12-11 08:39:56 +00:00
|
|
|
" help [command]\n".
|
|
|
|
" install [-r] <package file>\n".
|
|
|
|
" uninstall [-r] <package name>\n".
|
2001-04-17 01:17:59 +00:00
|
|
|
" package [package info file]\n".
|
2001-11-13 01:07:36 +00:00
|
|
|
" list-installed\n".
|
|
|
|
" list-available\n".
|
|
|
|
" info\n".
|
2001-10-31 05:39:11 +00:00
|
|
|
" show-config\n".
|
2001-04-17 01:17:59 +00:00
|
|
|
"\n");
|
2001-05-22 16:21:02 +00:00
|
|
|
fclose($stderr);
|
2001-01-08 02:45:30 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2001-10-26 10:07:43 +00:00
|
|
|
// }}}
|
2001-11-13 01:07:36 +00:00
|
|
|
// {{{ present_array()
|
2001-10-26 10:07:43 +00:00
|
|
|
|
2001-10-31 05:39:11 +00:00
|
|
|
function present_array(&$arr, $keys = null)
|
|
|
|
{
|
|
|
|
if ($keys === null) {
|
|
|
|
$keys = array_keys($arr);
|
|
|
|
}
|
2001-12-18 08:48:28 +00:00
|
|
|
$longest_key = max(array_map("strlen", array_keys($arr))) + 2;
|
2001-10-31 05:39:11 +00:00
|
|
|
$format_string = "%{$longest_key}s : %s\n";
|
|
|
|
foreach ($keys as $k) {
|
|
|
|
if (is_array($arr[$k])) {
|
2001-12-18 08:48:28 +00:00
|
|
|
foreach ($arr[$k] as $i => $value) {
|
|
|
|
$x = "$k #$i";
|
2001-12-18 08:52:48 +00:00
|
|
|
$cont = array();
|
2001-12-18 08:48:28 +00:00
|
|
|
foreach(array_keys($value) as $val) {
|
|
|
|
$cont[] = "$val=" . $value[$val];
|
|
|
|
}
|
|
|
|
$v = implode(", ", $cont);
|
|
|
|
printf($format_string, $x, $v);
|
|
|
|
}
|
|
|
|
continue;
|
2001-10-31 05:39:11 +00:00
|
|
|
} else {
|
|
|
|
$v = $arr[$k];
|
2001-12-18 08:48:28 +00:00
|
|
|
printf($format_string, $k, $v);
|
2001-10-31 05:39:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-13 01:07:36 +00:00
|
|
|
// }}}
|
2001-12-11 08:39:56 +00:00
|
|
|
// {{{ heading()
|
2001-11-13 01:07:36 +00:00
|
|
|
|
2001-12-11 08:39:56 +00:00
|
|
|
function heading($text)
|
|
|
|
{
|
|
|
|
$l = strlen(trim($text));
|
|
|
|
print rtrim($text) . "\n" . str_repeat("=", $l) . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
// }}}
|
2001-10-31 05:39:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*/
|
2001-12-12 01:35:03 +00:00
|
|
|
|
2000-07-17 22:52:08 +00:00
|
|
|
?>
|