Thu Oct 29 08:29:03 2009 UTC ()
Update pear from version 1.5.4nb3 to version 1.9.0.

Pkgsrc changes:
- Update base pear packages:Archive_Tar-1.3.3, Console_Getopt-1.2.3
Structures_Graph-1.0.3
- Update ${FILESDIR}/go-pear.php from latest version at
http://pear.php.net/go-pear
- Update ${FILESDIR}/pear.sh from the bundled version
- Provide bootstrap PEAR.php via ${FILESDIR}/PEAR.php from
http://cvs.php.net/viewvc.cgi/pear-core/PEAR.php?view=co&pathrev=PEAR_1_4
(see FILESDIR/go-pear.php's code) and put it into ${WRKSRC} at the extract
phase
- Update PLIST

Upstream changes:
A lot! IMHO more than what can be recorded here.
Please see individual releases Changelog since version 1.5.4
at http://pear.php.net/package/PEAR.


(seb)
diff -r1.10 -r1.11 pkgsrc/lang/pear/Makefile
diff -r1.4 -r1.5 pkgsrc/lang/pear/PLIST
diff -r1.4 -r1.5 pkgsrc/lang/pear/distinfo
diff -r0 -r1.1 pkgsrc/lang/pear/files/PEAR.php
diff -r1.1.1.1 -r1.2 pkgsrc/lang/pear/files/go-pear.php
diff -r1.2 -r1.3 pkgsrc/lang/pear/files/pear.sh
diff -r1.3 -r1.4 pkgsrc/lang/pear/patches/patch-aa

cvs diff -r1.10 -r1.11 pkgsrc/lang/pear/Makefile (expand / switch to unified diff)

--- pkgsrc/lang/pear/Makefile 2009/07/17 18:00:16 1.10
+++ pkgsrc/lang/pear/Makefile 2009/10/29 08:29:03 1.11
@@ -1,18 +1,18 @@ @@ -1,18 +1,18 @@
1# $NetBSD: Makefile,v 1.10 2009/07/17 18:00:16 adrianp Exp $ 1# $NetBSD: Makefile,v 1.11 2009/10/29 08:29:03 seb Exp $
2# 2#
3 3
4DISTNAME= PEAR-1.5.4 4DISTNAME= PEAR-1.9.0
5PKGREVISION= 3 5#PKGREVISION= 1
6PKGNAME= ${PHP_PKG_PREFIX}-${DISTNAME:S/PEAR/pear/} 6PKGNAME= ${PHP_PKG_PREFIX}-${DISTNAME:S/PEAR/pear/}
7CATEGORIES= lang 7CATEGORIES= lang
8MASTER_SITES= http://download.pear.php.net/package/ 8MASTER_SITES= http://download.pear.php.net/package/
9EXTRACT_SUFX= .tgz 9EXTRACT_SUFX= .tgz
10 10
11MAINTAINER= pkgsrc-users@NetBSD.org 11MAINTAINER= pkgsrc-users@NetBSD.org
12HOMEPAGE= http://pear.php.net/ 12HOMEPAGE= http://pear.php.net/
13COMMENT= PEAR Base System for PHP 13COMMENT= PEAR Base System for PHP
14 14
15USE_LANGUAGES= # none 15USE_LANGUAGES= # none
16EXTRACT_ONLY= # none 16EXTRACT_ONLY= # none
17USE_TOOLS+= gzcat 17USE_TOOLS+= gzcat
18 18
@@ -21,83 +21,84 @@ USE_TOOLS+= gzcat @@ -21,83 +21,84 @@ USE_TOOLS+= gzcat
21.if ${PKG_PHP_VERSION} == "4" 21.if ${PKG_PHP_VERSION} == "4"
22CONFLICTS+= php<4.4.6nb1 22CONFLICTS+= php<4.4.6nb1
23.elif ${PKG_PHP_VERSION} == "5" 23.elif ${PKG_PHP_VERSION} == "5"
24CONFLICTS+= php<5.2.1nb2 24CONFLICTS+= php<5.2.1nb2
25.endif 25.endif
26 26
27CONF_FILES= ${PREFIX}/share/examples/pear/pear.conf \ 27CONF_FILES= ${PREFIX}/share/examples/pear/pear.conf \
28 ${PKG_SYSCONFDIR}/pear.conf 28 ${PKG_SYSCONFDIR}/pear.conf
29 29
30BUNDLE= ${WRKSRC}/install/go-pear-bundle 30BUNDLE= ${WRKSRC}/install/go-pear-bundle
31 31
32# everything else that forms a part of the "base" PEAR install 32# everything else that forms a part of the "base" PEAR install
33# 33#
34PEAR_SRCS= PEAR-1.5.4${EXTRACT_SUFX} 34PEAR_SRCS= PEAR-1.9.0${EXTRACT_SUFX}
35DISTFILES+= ${PEAR_SRCS} 35DISTFILES+= ${PEAR_SRCS}
36EXTRACT_ONLY+= ${PEAR_SRCS} 36EXTRACT_ONLY+= ${PEAR_SRCS}
37 37
38ARCHIVE_SRCS= Archive_Tar-1.3.2${EXTRACT_SUFX} 38ARCHIVE_SRCS= Archive_Tar-1.3.3${EXTRACT_SUFX}
39ARCHIVE_WRKSRC= ${WRKDIR}/${ARCHIVE_SRCS:S/${EXTRACT_SUFX}//} 39ARCHIVE_WRKSRC= ${WRKDIR}/${ARCHIVE_SRCS:S/${EXTRACT_SUFX}//}
40DISTFILES+= ${ARCHIVE_SRCS} 40DISTFILES+= ${ARCHIVE_SRCS}
41EXTRACT_ONLY+= ${ARCHIVE_SRCS} 41EXTRACT_ONLY+= ${ARCHIVE_SRCS}
42 42
43CONSOLE_SRCS= Console_Getopt-1.2.2${EXTRACT_SUFX} 43CONSOLE_SRCS= Console_Getopt-1.2.3${EXTRACT_SUFX}
44CONSOLE_WRKSRC= ${WRKDIR}/${CONSOLE_SRCS:S/${EXTRACT_SUFX}//} 44CONSOLE_WRKSRC= ${WRKDIR}/${CONSOLE_SRCS:S/${EXTRACT_SUFX}//}
45DISTFILES+= ${CONSOLE_SRCS} 45DISTFILES+= ${CONSOLE_SRCS}
46EXTRACT_ONLY+= ${CONSOLE_SRCS} 46EXTRACT_ONLY+= ${CONSOLE_SRCS}
47 47
48STRUCTURES_SRCS= Structures_Graph-1.0.2${EXTRACT_SUFX} 48STRUCTURES_SRCS= Structures_Graph-1.0.3${EXTRACT_SUFX}
49DISTFILES+= ${STRUCTURES_SRCS} 49DISTFILES+= ${STRUCTURES_SRCS}
50# 50#
51# end of base components 51# end of base components
52 52
53SUBST_CLASSES+= config 53SUBST_CLASSES+= config
54SUBST_STAGE.config= post-patch 54SUBST_STAGE.config= post-patch
55SUBST_FILES.config= install/go-pear.php 55SUBST_FILES.config= install/go-pear.php
56SUBST_SED.config= -e "s|@WRKSRC@|${WRKSRC}|g" 56SUBST_SED.config= -e "s|@WRKSRC@|${WRKSRC}|g"
57SUBST_SED.config+= -e "s|@PREFIX@|${PREFIX}|g" 57SUBST_SED.config+= -e "s|@PREFIX@|${PREFIX}|g"
58SUBST_MESSAGE.config= Fixing configuration files. 58SUBST_MESSAGE.config= Fixing configuration files.
59 59
60SUBST_CLASSES+= pear 60SUBST_CLASSES+= pear
61SUBST_STAGE.pear= post-patch 61SUBST_STAGE.pear= post-patch
62SUBST_FILES.pear= pear.sh 62SUBST_FILES.pear= pear.sh
63SUBST_SED.pear= -e "s|@php_bin@|${PREFIX}/bin/php|g" 63SUBST_SED.pear= -e "s|@php_bin@|${PREFIX}/bin/php|g"
64SUBST_SED.pear+= -e "s|@php_dir@|${PREFIX}/lib/php|g" 64SUBST_SED.pear+= -e "s|@php_dir@|${PREFIX}/lib/php|g"
65SUBST_SED.pear+= -e "s|@SH@|${SH}|g" 65SUBST_SED.pear+= -e "s|@SH@|${SH}|g"
66SUBST_MESSAGE.pear= Fixing pear installation script. 66SUBST_MESSAGE.pear= Fixing pear installation script.
67 67
 68INSTALLATION_DIRS+= share/examples/pear
 69
68post-extract: 70post-extract:
69 ${RM} ${WRKSRC}/INSTALL 71 ${RM} ${WRKSRC}/INSTALL
70 ${MKDIR} ${WRKSRC}/install 72 ${MKDIR} ${WRKSRC}/install
71 ${MKDIR} ${BUNDLE} 73 ${MKDIR} ${BUNDLE}
72 ${CP} ${FILESDIR}/go-pear.php ${WRKSRC}/install 74 ${CP} ${FILESDIR}/go-pear.php ${WRKSRC}/install
73 ${CP} ${FILESDIR}/pear.sh ${WRKSRC} 75 ${CP} ${FILESDIR}/pear.sh ${WRKSRC}
 76 ${CP} ${FILESDIR}/PEAR.php ${BUNDLE}
74 77
75do-build: 78do-build:
76 ${GZCAT} ${DISTDIR}/${ARCHIVE_SRCS} > \ 79 ${GZCAT} ${DISTDIR}/${ARCHIVE_SRCS} > \
77 ${BUNDLE}/${ARCHIVE_SRCS:S/${EXTRACT_SUFX}/.tar/} 80 ${BUNDLE}/${ARCHIVE_SRCS:S/${EXTRACT_SUFX}/.tar/}
78 ${GZCAT} ${DISTDIR}/${CONSOLE_SRCS} > \ 81 ${GZCAT} ${DISTDIR}/${CONSOLE_SRCS} > \
79 ${BUNDLE}/${CONSOLE_SRCS:S/${EXTRACT_SUFX}/.tar/} 82 ${BUNDLE}/${CONSOLE_SRCS:S/${EXTRACT_SUFX}/.tar/}
80 ${GZCAT} ${DISTDIR}/${PEAR_SRCS} > \ 83 ${GZCAT} ${DISTDIR}/${PEAR_SRCS} > \
81 ${BUNDLE}/${PEAR_SRCS:S/${EXTRACT_SUFX}/.tar/} 84 ${BUNDLE}/${PEAR_SRCS:S/${EXTRACT_SUFX}/.tar/}
82 ${GZCAT} ${DISTDIR}/${STRUCTURES_SRCS} > \ 85 ${GZCAT} ${DISTDIR}/${STRUCTURES_SRCS} > \
83 ${BUNDLE}/${STRUCTURES_SRCS:S/${EXTRACT_SUFX}/.tar/} 86 ${BUNDLE}/${STRUCTURES_SRCS:S/${EXTRACT_SUFX}/.tar/}
84 87
85 ${CP} ${ARCHIVE_WRKSRC}/Archive/Tar.php ${BUNDLE} 88 ${CP} ${ARCHIVE_WRKSRC}/Archive/Tar.php ${BUNDLE}
86 ${CP} ${CONSOLE_WRKSRC}/Console/Getopt.php ${BUNDLE} 89 ${CP} ${CONSOLE_WRKSRC}/Console/Getopt.php ${BUNDLE}
87 ${CP} ${WRKSRC}/PEAR.php ${BUNDLE} 
88 90
89do-install: 91do-install:
90 ${INSTALL_DATA_DIR} ${DESTDIR}${PREFIX}/share/examples/pear 
91 ${PREFIX}/bin/php ${DESTDIR}${WRKSRC}/install/go-pear.php local 92 ${PREFIX}/bin/php ${DESTDIR}${WRKSRC}/install/go-pear.php local
92 ${INSTALL_SCRIPT} ${WRKSRC}/pear.sh ${DESTDIR}${PREFIX}/bin/pear 93 ${INSTALL_SCRIPT} ${WRKSRC}/pear.sh ${DESTDIR}${PREFIX}/bin/pear
93 ${INSTALL_DATA} ${WRKSRC}/pear.conf \ 94 ${INSTALL_DATA} ${WRKSRC}/pear.conf \
94 ${DESTDIR}${PREFIX}/share/examples/pear/pear.conf 95 ${DESTDIR}${PREFIX}/share/examples/pear/pear.conf
95 96
96.include "${PHPPKGSRCDIR}/buildlink3.mk" 97.include "${PHPPKGSRCDIR}/buildlink3.mk"
97 98
98.if ${PKG_PHP_VERSION} == "4" 99.if ${PKG_PHP_VERSION} == "4"
99BUILDLINK_API_DEPENDS.php+= php>=4.4.6nb1 100BUILDLINK_API_DEPENDS.php+= php>=4.4.6nb1
100.elif ${PKG_PHP_VERSION} == "5" 101.elif ${PKG_PHP_VERSION} == "5"
101BUILDLINK_API_DEPENDS.php+= php>=5.2.1nb2 102BUILDLINK_API_DEPENDS.php+= php>=5.2.1nb2
102.endif 103.endif
103 104

cvs diff -r1.4 -r1.5 pkgsrc/lang/pear/PLIST (expand / switch to unified diff)

--- pkgsrc/lang/pear/PLIST 2009/06/14 20:34:14 1.4
+++ pkgsrc/lang/pear/PLIST 2009/10/29 08:29:03 1.5
@@ -1,20 +1,22 @@ @@ -1,20 +1,22 @@
1@comment $NetBSD: PLIST,v 1.4 2009/06/14 20:34:14 joerg Exp $ 1@comment $NetBSD: PLIST,v 1.5 2009/10/29 08:29:03 seb Exp $
2bin/pear 2bin/pear
3bin/peardev 3bin/peardev
4bin/pecl 4bin/pecl
5lib/php/.channels/.alias/pear.txt 5lib/php/.channels/.alias/pear.txt
6lib/php/.channels/.alias/pecl.txt 6lib/php/.channels/.alias/pecl.txt
 7lib/php/.channels/.alias/phpdocs.txt
7lib/php/.channels/__uri.reg 8lib/php/.channels/__uri.reg
 9lib/php/.channels/doc.php.net.reg
8lib/php/.channels/pear.php.net.reg 10lib/php/.channels/pear.php.net.reg
9lib/php/.channels/pecl.php.net.reg 11lib/php/.channels/pecl.php.net.reg
10lib/php/.depdb 12lib/php/.depdb
11lib/php/.depdblock 13lib/php/.depdblock
12lib/php/.filemap 14lib/php/.filemap
13lib/php/.lock 15lib/php/.lock
14lib/php/.registry/archive_tar.reg 16lib/php/.registry/archive_tar.reg
15lib/php/.registry/console_getopt.reg 17lib/php/.registry/console_getopt.reg
16lib/php/.registry/pear.reg 18lib/php/.registry/pear.reg
17lib/php/.registry/structures_graph.reg 19lib/php/.registry/structures_graph.reg
18lib/php/Archive/Tar.php 20lib/php/Archive/Tar.php
19lib/php/Console/Getopt.php 21lib/php/Console/Getopt.php
20lib/php/OS/Guess.php 22lib/php/OS/Guess.php
@@ -39,110 +41,113 @@ lib/php/PEAR/Command/Mirror.php @@ -39,110 +41,113 @@ lib/php/PEAR/Command/Mirror.php
39lib/php/PEAR/Command/Mirror.xml 41lib/php/PEAR/Command/Mirror.xml
40lib/php/PEAR/Command/Package.php 42lib/php/PEAR/Command/Package.php
41lib/php/PEAR/Command/Package.xml 43lib/php/PEAR/Command/Package.xml
42lib/php/PEAR/Command/Pickle.php 44lib/php/PEAR/Command/Pickle.php
43lib/php/PEAR/Command/Pickle.xml 45lib/php/PEAR/Command/Pickle.xml
44lib/php/PEAR/Command/Registry.php 46lib/php/PEAR/Command/Registry.php
45lib/php/PEAR/Command/Registry.xml 47lib/php/PEAR/Command/Registry.xml
46lib/php/PEAR/Command/Remote.php 48lib/php/PEAR/Command/Remote.php
47lib/php/PEAR/Command/Remote.xml 49lib/php/PEAR/Command/Remote.xml
48lib/php/PEAR/Command/Test.php 50lib/php/PEAR/Command/Test.php
49lib/php/PEAR/Command/Test.xml 51lib/php/PEAR/Command/Test.xml
50lib/php/PEAR/Common.php 52lib/php/PEAR/Common.php
51lib/php/PEAR/Config.php 53lib/php/PEAR/Config.php
52lib/php/PEAR/Dependency.php 
53lib/php/PEAR/Dependency2.php 54lib/php/PEAR/Dependency2.php
54lib/php/PEAR/DependencyDB.php 55lib/php/PEAR/DependencyDB.php
55lib/php/PEAR/Downloader.php 56lib/php/PEAR/Downloader.php
56lib/php/PEAR/Downloader/Package.php 57lib/php/PEAR/Downloader/Package.php
57lib/php/PEAR/ErrorStack.php 58lib/php/PEAR/ErrorStack.php
58lib/php/PEAR/Exception.php 59lib/php/PEAR/Exception.php
 60lib/php/PEAR/FixPHP5PEARWarnings.php
59lib/php/PEAR/Frontend.php 61lib/php/PEAR/Frontend.php
60lib/php/PEAR/Frontend/CLI.php 62lib/php/PEAR/Frontend/CLI.php
61lib/php/PEAR/Installer.php 63lib/php/PEAR/Installer.php
62lib/php/PEAR/Installer/Role.php 64lib/php/PEAR/Installer/Role.php
 65lib/php/PEAR/Installer/Role/Cfg.php
 66lib/php/PEAR/Installer/Role/Cfg.xml
63lib/php/PEAR/Installer/Role/Common.php 67lib/php/PEAR/Installer/Role/Common.php
64lib/php/PEAR/Installer/Role/Data.php 68lib/php/PEAR/Installer/Role/Data.php
65lib/php/PEAR/Installer/Role/Data.xml 69lib/php/PEAR/Installer/Role/Data.xml
66lib/php/PEAR/Installer/Role/Doc.php 70lib/php/PEAR/Installer/Role/Doc.php
67lib/php/PEAR/Installer/Role/Doc.xml 71lib/php/PEAR/Installer/Role/Doc.xml
68lib/php/PEAR/Installer/Role/Ext.php 72lib/php/PEAR/Installer/Role/Ext.php
69lib/php/PEAR/Installer/Role/Ext.xml 73lib/php/PEAR/Installer/Role/Ext.xml
70lib/php/PEAR/Installer/Role/Php.php 74lib/php/PEAR/Installer/Role/Php.php
71lib/php/PEAR/Installer/Role/Php.xml 75lib/php/PEAR/Installer/Role/Php.xml
72lib/php/PEAR/Installer/Role/Script.php 76lib/php/PEAR/Installer/Role/Script.php
73lib/php/PEAR/Installer/Role/Script.xml 77lib/php/PEAR/Installer/Role/Script.xml
74lib/php/PEAR/Installer/Role/Src.php 78lib/php/PEAR/Installer/Role/Src.php
75lib/php/PEAR/Installer/Role/Src.xml 79lib/php/PEAR/Installer/Role/Src.xml
76lib/php/PEAR/Installer/Role/Test.php 80lib/php/PEAR/Installer/Role/Test.php
77lib/php/PEAR/Installer/Role/Test.xml 81lib/php/PEAR/Installer/Role/Test.xml
 82lib/php/PEAR/Installer/Role/Www.php
 83lib/php/PEAR/Installer/Role/Www.xml
78lib/php/PEAR/PackageFile.php 84lib/php/PEAR/PackageFile.php
79lib/php/PEAR/PackageFile/Generator/v1.php 85lib/php/PEAR/PackageFile/Generator/v1.php
80lib/php/PEAR/PackageFile/Generator/v2.php 86lib/php/PEAR/PackageFile/Generator/v2.php
81lib/php/PEAR/PackageFile/Parser/v1.php 87lib/php/PEAR/PackageFile/Parser/v1.php
82lib/php/PEAR/PackageFile/Parser/v2.php 88lib/php/PEAR/PackageFile/Parser/v2.php
83lib/php/PEAR/PackageFile/v1.php 89lib/php/PEAR/PackageFile/v1.php
84lib/php/PEAR/PackageFile/v2.php 90lib/php/PEAR/PackageFile/v2.php
85lib/php/PEAR/PackageFile/v2/Validator.php 91lib/php/PEAR/PackageFile/v2/Validator.php
86lib/php/PEAR/PackageFile/v2/rw.php 92lib/php/PEAR/PackageFile/v2/rw.php
87lib/php/PEAR/Packager.php 93lib/php/PEAR/Packager.php
88lib/php/PEAR/REST.php 94lib/php/PEAR/REST.php
89lib/php/PEAR/REST/10.php 95lib/php/PEAR/REST/10.php
90lib/php/PEAR/REST/11.php 96lib/php/PEAR/REST/11.php
 97lib/php/PEAR/REST/13.php
91lib/php/PEAR/Registry.php 98lib/php/PEAR/Registry.php
92lib/php/PEAR/Remote.php 
93lib/php/PEAR/RunTest.php 99lib/php/PEAR/RunTest.php
94lib/php/PEAR/Task/Common.php 100lib/php/PEAR/Task/Common.php
95lib/php/PEAR/Task/Postinstallscript.php 101lib/php/PEAR/Task/Postinstallscript.php
96lib/php/PEAR/Task/Postinstallscript/rw.php 102lib/php/PEAR/Task/Postinstallscript/rw.php
97lib/php/PEAR/Task/Replace.php 103lib/php/PEAR/Task/Replace.php
98lib/php/PEAR/Task/Replace/rw.php 104lib/php/PEAR/Task/Replace/rw.php
99lib/php/PEAR/Task/Unixeol.php 105lib/php/PEAR/Task/Unixeol.php
100lib/php/PEAR/Task/Unixeol/rw.php 106lib/php/PEAR/Task/Unixeol/rw.php
101lib/php/PEAR/Task/Windowseol.php 107lib/php/PEAR/Task/Windowseol.php
102lib/php/PEAR/Task/Windowseol/rw.php 108lib/php/PEAR/Task/Windowseol/rw.php
103lib/php/PEAR/Validate.php 109lib/php/PEAR/Validate.php
104lib/php/PEAR/Validator/PECL.php 110lib/php/PEAR/Validator/PECL.php
105lib/php/PEAR/XMLParser.php 111lib/php/PEAR/XMLParser.php
 112lib/php/PEAR5.php
106lib/php/Structures/Graph.php 113lib/php/Structures/Graph.php
107lib/php/Structures/Graph/Manipulator/AcyclicTest.php 114lib/php/Structures/Graph/Manipulator/AcyclicTest.php
108lib/php/Structures/Graph/Manipulator/TopologicalSorter.php 115lib/php/Structures/Graph/Manipulator/TopologicalSorter.php
109lib/php/Structures/Graph/Node.php 116lib/php/Structures/Graph/Node.php
110lib/php/System.php 117lib/php/System.php
111lib/php/data/PEAR/package.dtd 118lib/php/data/PEAR/package.dtd
112lib/php/data/PEAR/template.spec 119lib/php/data/PEAR/template.spec
113lib/php/data/Structures_Graph/LICENSE 120lib/php/data/Structures_Graph/LICENSE
114lib/php/data/Structures_Graph/genpackage.xml.pl 
115lib/php/data/Structures_Graph/package.sh 
116lib/php/data/Structures_Graph/publish.sh 
117lib/php/doc/Archive_Tar/docs/Archive_Tar.txt 121lib/php/doc/Archive_Tar/docs/Archive_Tar.txt
118lib/php/doc/PEAR/INSTALL 122lib/php/doc/PEAR/INSTALL
 123lib/php/doc/PEAR/LICENSE
119lib/php/doc/PEAR/README 124lib/php/doc/PEAR/README
120lib/php/doc/Structures_Graph/docs/generate.sh 125lib/php/doc/Structures_Graph/docs/generate.sh
121lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph.html 126lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph.html
122lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html 127lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_AcyclicTest.html
123lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html 128lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Manipulator_TopologicalSorter.html
124lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Node.html 129lib/php/doc/Structures_Graph/docs/html/Structures_Graph/Structures_Graph_Node.html
125lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html 130lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_AcyclicTest_php.html
126lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html 131lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Manipulator_TopologicalSorter_php.html
127lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Node_php.html 132lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_Node_php.html
128lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_php.html 133lib/php/doc/Structures_Graph/docs/html/Structures_Graph/_Structures_Graph_php.html
129lib/php/doc/Structures_Graph/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html 134lib/php/doc/Structures_Graph/docs/html/Structures_Graph/tutorial_Structures_Graph.pkg.html
130lib/php/doc/Structures_Graph/docs/html/classtrees_Structures_Graph.html 135lib/php/doc/Structures_Graph/docs/html/classtrees_Structures_Graph.html
131lib/php/doc/Structures_Graph/docs/html/elementindex.html 136lib/php/doc/Structures_Graph/docs/html/elementindex.html
132lib/php/doc/Structures_Graph/docs/html/elementindex_Structures_Graph.html 137lib/php/doc/Structures_Graph/docs/html/elementindex_Structures_Graph.html
133lib/php/doc/Structures_Graph/docs/html/errors.html 138lib/php/doc/Structures_Graph/docs/html/errors.html
134lib/php/doc/Structures_Graph/docs/html/index.html 139lib/php/doc/Structures_Graph/docs/html/index.html
135lib/php/doc/Structures_Graph/docs/html/li_Structures_Graph.html 140lib/php/doc/Structures_Graph/docs/html/li_Structures_Graph.html
136lib/php/doc/Structures_Graph/docs/html/media/banner.css 141lib/php/doc/Structures_Graph/docs/html/media/banner.css
137lib/php/doc/Structures_Graph/docs/html/media/stylesheet.css 142lib/php/doc/Structures_Graph/docs/html/media/stylesheet.css
138lib/php/doc/Structures_Graph/docs/html/packages.html 143lib/php/doc/Structures_Graph/docs/html/packages.html
139lib/php/doc/Structures_Graph/docs/html/todolist.html 144lib/php/doc/Structures_Graph/docs/html/todolist.html
140lib/php/doc/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg 145lib/php/doc/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg
141lib/php/pearcmd.php 146lib/php/pearcmd.php
142lib/php/peclcmd.php 147lib/php/peclcmd.php
143lib/php/test/Structures_Graph/tests/README 148lib/php/test/Structures_Graph/tests/AllTests.php
144lib/php/test/Structures_Graph/tests/all-tests.php 
145lib/php/test/Structures_Graph/tests/testCase/BasicGraph.php 149lib/php/test/Structures_Graph/tests/testCase/BasicGraph.php
146share/examples/pear/pear.conf 150share/examples/pear/pear.conf
147@pkgdir lib/php/.registry/.channel.__uri 
148@pkgdir lib/php/.registry/.channel.pecl.php.net 151@pkgdir lib/php/.registry/.channel.pecl.php.net
 152@pkgdir lib/php/.registry/.channel.doc.php.net
 153@pkgdir lib/php/.registry/.channel.__uri

cvs diff -r1.4 -r1.5 pkgsrc/lang/pear/distinfo (expand / switch to unified diff)

--- pkgsrc/lang/pear/distinfo 2008/09/15 11:54:21 1.4
+++ pkgsrc/lang/pear/distinfo 2009/10/29 08:29:03 1.5
@@ -1,15 +1,18 @@ @@ -1,15 +1,18 @@
1$NetBSD: distinfo,v 1.4 2008/09/15 11:54:21 adrianp Exp $ 1$NetBSD: distinfo,v 1.5 2009/10/29 08:29:03 seb Exp $
2 2
3SHA1 (Archive_Tar-1.3.2.tgz) = 40a16c6fe6cee12d9fd87d487785db2949ffa9ff 3SHA1 (Archive_Tar-1.3.3.tgz) = b49de079aee8c087c19b718534503234670598cb
4RMD160 (Archive_Tar-1.3.2.tgz) = cec105d1cdefd502f209c24c217645cec723d7a2 4RMD160 (Archive_Tar-1.3.3.tgz) = 3abe03b42ee81b6ddf5449db6277806f664aec6b
5Size (Archive_Tar-1.3.2.tgz) = 17150 bytes 5Size (Archive_Tar-1.3.3.tgz) = 18119 bytes
6SHA1 (Console_Getopt-1.2.2.tgz) = 3158237f6cd8ed34a269c67cbe546156c03cff0b 6SHA1 (Console_Getopt-1.2.3.tgz) = 2f4ea028f478123164c3f6588f8a505dc35915df
7RMD160 (Console_Getopt-1.2.2.tgz) = fb8a955ef2c41618305e03c9a4164c3a465c5e86 7RMD160 (Console_Getopt-1.2.3.tgz) = d1624dbcb223395ded9e46285f896d6f5bb5ca74
8Size (Console_Getopt-1.2.2.tgz) = 4252 bytes 8Size (Console_Getopt-1.2.3.tgz) = 4011 bytes
9SHA1 (PEAR-1.5.4.tgz) = f03a8bfbd68bd1834829a67346711fd157da3685 9SHA1 (PEAR-1.9.0.tgz) = a268b9af85a3daad047c77947838932f2737e6aa
10RMD160 (PEAR-1.5.4.tgz) = 2e3ede082a7f6b085cfd414ddaf5b0d9dad1372f 10RMD160 (PEAR-1.9.0.tgz) = cfac92b7569676783b44a38309f8a156f49a35e8
11Size (PEAR-1.5.4.tgz) = 293070 bytes 11Size (PEAR-1.9.0.tgz) = 291634 bytes
12SHA1 (Structures_Graph-1.0.2.tgz) = 300aa0a2effb0b39c4fa8a63a834748ae99c2855 12SHA1 (Structures_Graph-1.0.3.tgz) = 13761cc4788f6c272730abe110a5a5048be18643
13RMD160 (Structures_Graph-1.0.2.tgz) = 8eb53f6da109b90bab5d8101e99183a1ae116404 13RMD160 (Structures_Graph-1.0.3.tgz) = 835cfc8c4cd7475f5486c710abe5dd9737c1b476
14Size (Structures_Graph-1.0.2.tgz) = 30947 bytes 14Size (Structures_Graph-1.0.3.tgz) = 30191 bytes
15SHA1 (patch-aa) = b7938a5143f27f167a3065f6331bd34cd0d65153 15SHA1 (XML_Util-1.2.1.tgz) = 8072216577fb9ad684f15e0388ab0b1c0b57e2d4
 16RMD160 (XML_Util-1.2.1.tgz) = 9d9dd43889312f46f39c9a43a800a8f2d8f6e9b2
 17Size (XML_Util-1.2.1.tgz) = 17729 bytes
 18SHA1 (patch-aa) = 8d4d9762c26e878ab78e465eace3c4bac1a7ef5f

File Added: pkgsrc/lang/pear/files/Attic/PEAR.php
<?php
/**
 * PEAR, the PHP Extension and Application Repository
 *
 * PEAR class and PEAR_Error class
 *
 * PHP versions 4 and 5
 *
 * LICENSE: This source file is subject to version 3.0 of the PHP license
 * that is available through the world-wide-web at the following URI:
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
 * the PHP License and are unable to obtain it through the web, please
 * send a note to license@php.net so we can mail you a copy immediately.
 *
 * @category   pear
 * @package    PEAR
 * @author     Sterling Hughes <sterling@php.net>
 * @author     Stig Bakken <ssb@php.net>
 * @author     Tomas V.V.Cox <cox@idecnet.com>
 * @author     Greg Beaver <cellog@php.net>
 * @copyright  1997-2006 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    CVS: Id: PEAR.php,v 1.97 2006/01/06 04:47:36 cellog Exp
 * @link       http://pear.php.net/package/PEAR
 * @since      File available since Release 0.1
 */

/*
 * $NetBSD: PEAR.php,v 1.1 2009/10/29 08:29:03 seb Exp $
 *
 * This is http://cvs.php.net/viewvc.cgi/pear-core/PEAR.php?view=co&pathrev=PEAR_1_4
 *
 * See $bootstrap_files definition in go-pear.php
 *
 */

/**#@+
 * ERROR constants
 */
define('PEAR_ERROR_RETURN',     1);
define('PEAR_ERROR_PRINT',      2);
define('PEAR_ERROR_TRIGGER',    4);
define('PEAR_ERROR_DIE',        8);
define('PEAR_ERROR_CALLBACK',  16);
/**
 * WARNING: obsolete
 * @deprecated
 */
define('PEAR_ERROR_EXCEPTION', 32);
/**#@-*/
define('PEAR_ZE2', (function_exists('version_compare') &&
                    version_compare(zend_version(), "2-dev", "ge")));

if (substr(PHP_OS, 0, 3) == 'WIN') {
    define('OS_WINDOWS', true);
    define('OS_UNIX',    false);
    define('PEAR_OS',    'Windows');
} else {
    define('OS_WINDOWS', false);
    define('OS_UNIX',    true);
    define('PEAR_OS',    'Unix'); // blatant assumption
}

// instant backwards compatibility
if (!defined('PATH_SEPARATOR')) {
    if (OS_WINDOWS) {
        define('PATH_SEPARATOR', ';');
    } else {
        define('PATH_SEPARATOR', ':');
    }
}

$GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
$GLOBALS['_PEAR_default_error_options']  = E_USER_NOTICE;
$GLOBALS['_PEAR_destructor_object_list'] = array();
$GLOBALS['_PEAR_shutdown_funcs']         = array();
$GLOBALS['_PEAR_error_handler_stack']    = array();

@ini_set('track_errors', true);

/**
 * Base class for other PEAR classes.  Provides rudimentary
 * emulation of destructors.
 *
 * If you want a destructor in your class, inherit PEAR and make a
 * destructor method called _yourclassname (same name as the
 * constructor, but with a "_" prefix).  Also, in your constructor you
 * have to call the PEAR constructor: $this->PEAR();.
 * The destructor method will be called without parameters.  Note that
 * at in some SAPI implementations (such as Apache), any output during
 * the request shutdown (in which destructors are called) seems to be
 * discarded.  If you need to get any debug information from your
 * destructor, use error_log(), syslog() or something similar.
 *
 * IMPORTANT! To use the emulated destructors you need to create the
 * objects by reference: $obj =& new PEAR_child;
 *
 * @category   pear
 * @package    PEAR
 * @author     Stig Bakken <ssb@php.net>
 * @author     Tomas V.V. Cox <cox@idecnet.com>
 * @author     Greg Beaver <cellog@php.net>
 * @copyright  1997-2006 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    Release: @package_version@
 * @link       http://pear.php.net/package/PEAR
 * @see        PEAR_Error
 * @since      Class available since PHP 4.0.2
 * @link        http://pear.php.net/manual/en/core.pear.php#core.pear.pear
 */
class PEAR
{
    // {{{ properties

    /**
     * Whether to enable internal debug messages.
     *
     * @var     bool
     * @access  private
     */
    var $_debug = false;

    /**
     * Default error mode for this object.
     *
     * @var     int
     * @access  private
     */
    var $_default_error_mode = null;

    /**
     * Default error options used for this object when error mode
     * is PEAR_ERROR_TRIGGER.
     *
     * @var     int
     * @access  private
     */
    var $_default_error_options = null;

    /**
     * Default error handler (callback) for this object, if error mode is
     * PEAR_ERROR_CALLBACK.
     *
     * @var     string
     * @access  private
     */
    var $_default_error_handler = '';

    /**
     * Which class to use for error objects.
     *
     * @var     string
     * @access  private
     */
    var $_error_class = 'PEAR_Error';

    /**
     * An array of expected errors.
     *
     * @var     array
     * @access  private
     */
    var $_expected_errors = array();

    // }}}

    // {{{ constructor

    /**
     * Constructor.  Registers this object in
     * $_PEAR_destructor_object_list for destructor emulation if a
     * destructor object exists.
     *
     * @param string $error_class  (optional) which class to use for
     *        error objects, defaults to PEAR_Error.
     * @access public
     * @return void
     */
    function PEAR($error_class = null)
    {
        $classname = strtolower(get_class($this));
        if ($this->_debug) {
            print "PEAR constructor called, class=$classname\n";
        }
        if ($error_class !== null) {
            $this->_error_class = $error_class;
        }
        while ($classname && strcasecmp($classname, "pear")) {
            $destructor = "_$classname";
            if (method_exists($this, $destructor)) {
                global $_PEAR_destructor_object_list;
                $_PEAR_destructor_object_list[] = &$this;
                if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
                    register_shutdown_function("_PEAR_call_destructors");
                    $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
                }
                break;
            } else {
                $classname = get_parent_class($classname);
            }
        }
    }

    // }}}
    // {{{ destructor

    /**
     * Destructor (the emulated type of...).  Does nothing right now,
     * but is included for forward compatibility, so subclass
     * destructors should always call it.
     *
     * See the note in the class desciption about output from
     * destructors.
     *
     * @access public
     * @return void
     */
    function _PEAR() {
        if ($this->_debug) {
            printf("PEAR destructor called, class=%s\n", strtolower(get_class($this)));
        }
    }

    // }}}
    // {{{ getStaticProperty()

    /**
    * If you have a class that's mostly/entirely static, and you need static
    * properties, you can use this method to simulate them. Eg. in your method(s)
    * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar');
    * You MUST use a reference, or they will not persist!
    *
    * @access public
    * @param  string $class  The calling classname, to prevent clashes
    * @param  string $var    The variable to retrieve.
    * @return mixed   A reference to the variable. If not set it will be
    *                 auto initialised to NULL.
    */
    function &getStaticProperty($class, $var)
    {
        static $properties;
        return $properties[$class][$var];
    }

    // }}}
    // {{{ registerShutdownFunc()

    /**
    * Use this function to register a shutdown method for static
    * classes.
    *
    * @access public
    * @param  mixed $func  The function name (or array of class/method) to call
    * @param  mixed $args  The arguments to pass to the function
    * @return void
    */
    function registerShutdownFunc($func, $args = array())
    {
        // if we are called statically, there is a potential
        // that no shutdown func is registered.  Bug #6445
        if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) {
            register_shutdown_function("_PEAR_call_destructors");
            $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true;
        }
        $GLOBALS['_PEAR_shutdown_funcs'][] = array($func, $args);
    }

    // }}}
    // {{{ isError()

    /**
     * Tell whether a value is a PEAR error.
     *
     * @param   mixed $data   the value to test
     * @param   int   $code   if $data is an error object, return true
     *                        only if $code is a string and
     *                        $obj->getMessage() == $code or
     *                        $code is an integer and $obj->getCode() == $code
     * @access  public
     * @return  bool    true if parameter is an error
     */
    function isError($data, $code = null)
    {
        if (is_a($data, 'PEAR_Error')) {
            if (is_null($code)) {
                return true;
            } elseif (is_string($code)) {
                return $data->getMessage() == $code;
            } else {
                return $data->getCode() == $code;
            }
        }
        return false;
    }

    // }}}
    // {{{ setErrorHandling()

    /**
     * Sets how errors generated by this object should be handled.
     * Can be invoked both in objects and statically.  If called
     * statically, setErrorHandling sets the default behaviour for all
     * PEAR objects.  If called in an object, setErrorHandling sets
     * the default behaviour for that object.
     *
     * @param int $mode
     *        One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
     *        PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
     *        PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION.
     *
     * @param mixed $options
     *        When $mode is PEAR_ERROR_TRIGGER, this is the error level (one
     *        of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
     *
     *        When $mode is PEAR_ERROR_CALLBACK, this parameter is expected
     *        to be the callback function or method.  A callback
     *        function is a string with the name of the function, a
     *        callback method is an array of two elements: the element
     *        at index 0 is the object, and the element at index 1 is
     *        the name of the method to call in the object.
     *
     *        When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is
     *        a printf format string used when printing the error
     *        message.
     *
     * @access public
     * @return void
     * @see PEAR_ERROR_RETURN
     * @see PEAR_ERROR_PRINT
     * @see PEAR_ERROR_TRIGGER
     * @see PEAR_ERROR_DIE
     * @see PEAR_ERROR_CALLBACK
     * @see PEAR_ERROR_EXCEPTION
     *
     * @since PHP 4.0.5
     */

    function setErrorHandling($mode = null, $options = null)
    {
        if (isset($this) && is_a($this, 'PEAR')) {
            $setmode     = &$this->_default_error_mode;
            $setoptions  = &$this->_default_error_options;
        } else {
            $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
            $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
        }

        switch ($mode) {
            case PEAR_ERROR_EXCEPTION:
            case PEAR_ERROR_RETURN:
            case PEAR_ERROR_PRINT:
            case PEAR_ERROR_TRIGGER:
            case PEAR_ERROR_DIE:
            case null:
                $setmode = $mode;
                $setoptions = $options;
                break;

            case PEAR_ERROR_CALLBACK:
                $setmode = $mode;
                // class/object method callback
                if (is_callable($options)) {
                    $setoptions = $options;
                } else {
                    trigger_error("invalid error callback", E_USER_WARNING);
                }
                break;

            default:
                trigger_error("invalid error mode", E_USER_WARNING);
                break;
        }
    }

    // }}}
    // {{{ expectError()

    /**
     * This method is used to tell which errors you expect to get.
     * Expected errors are always returned with error mode
     * PEAR_ERROR_RETURN.  Expected error codes are stored in a stack,
     * and this method pushes a new element onto it.  The list of
     * expected errors are in effect until they are popped off the
     * stack with the popExpect() method.
     *
     * Note that this method can not be called statically
     *
     * @param mixed $code a single error code or an array of error codes to expect
     *
     * @return int     the new depth of the "expected errors" stack
     * @access public
     */
    function expectError($code = '*')
    {
        if (is_array($code)) {
            array_push($this->_expected_errors, $code);
        } else {
            array_push($this->_expected_errors, array($code));
        }
        return sizeof($this->_expected_errors);
    }

    // }}}
    // {{{ popExpect()

    /**
     * This method pops one element off the expected error codes
     * stack.
     *
     * @return array   the list of error codes that were popped
     */
    function popExpect()
    {
        return array_pop($this->_expected_errors);
    }

    // }}}
    // {{{ _checkDelExpect()

    /**
     * This method checks unsets an error code if available
     *
     * @param mixed error code
     * @return bool true if the error code was unset, false otherwise
     * @access private
     * @since PHP 4.3.0
     */
    function _checkDelExpect($error_code)
    {
        $deleted = false;

        foreach ($this->_expected_errors AS $key => $error_array) {
            if (in_array($error_code, $error_array)) {
                unset($this->_expected_errors[$key][array_search($error_code, $error_array)]);
                $deleted = true;
            }

            // clean up empty arrays
            if (0 == count($this->_expected_errors[$key])) {
                unset($this->_expected_errors[$key]);
            }
        }
        return $deleted;
    }

    // }}}
    // {{{ delExpect()

    /**
     * This method deletes all occurences of the specified element from
     * the expected error codes stack.
     *
     * @param  mixed $error_code error code that should be deleted
     * @return mixed list of error codes that were deleted or error
     * @access public
     * @since PHP 4.3.0
     */
    function delExpect($error_code)
    {
        $deleted = false;

        if ((is_array($error_code) && (0 != count($error_code)))) {
            // $error_code is a non-empty array here;
            // we walk through it trying to unset all
            // values
            foreach($error_code as $key => $error) {
                if ($this->_checkDelExpect($error)) {
                    $deleted =  true;
                } else {
                    $deleted = false;
                }
            }
            return $deleted ? true : PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
        } elseif (!empty($error_code)) {
            // $error_code comes alone, trying to unset it
            if ($this->_checkDelExpect($error_code)) {
                return true;
            } else {
                return PEAR::raiseError("The expected error you submitted does not exist"); // IMPROVE ME
            }
        } else {
            // $error_code is empty
            return PEAR::raiseError("The expected error you submitted is empty"); // IMPROVE ME
        }
    }

    // }}}
    // {{{ raiseError()

    /**
     * This method is a wrapper that returns an instance of the
     * configured error class with this object's default error
     * handling applied.  If the $mode and $options parameters are not
     * specified, the object's defaults are used.
     *
     * @param mixed $message a text error message or a PEAR error object
     *
     * @param int $code      a numeric error code (it is up to your class
     *                  to define these if you want to use codes)
     *
     * @param int $mode      One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT,
     *                  PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE,
     *                  PEAR_ERROR_CALLBACK, PEAR_ERROR_EXCEPTION.
     *
     * @param mixed $options If $mode is PEAR_ERROR_TRIGGER, this parameter
     *                  specifies the PHP-internal error level (one of
     *                  E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR).
     *                  If $mode is PEAR_ERROR_CALLBACK, this
     *                  parameter specifies the callback function or
     *                  method.  In other error modes this parameter
     *                  is ignored.
     *
     * @param string $userinfo If you need to pass along for example debug
     *                  information, this parameter is meant for that.
     *
     * @param string $error_class The returned error object will be
     *                  instantiated from this class, if specified.
     *
     * @param bool $skipmsg If true, raiseError will only pass error codes,
     *                  the error message parameter will be dropped.
     *
     * @access public
     * @return object   a PEAR error object
     * @see PEAR::setErrorHandling
     * @since PHP 4.0.5
     */
    function &raiseError($message = null,
                         $code = null,
                         $mode = null,
                         $options = null,
                         $userinfo = null,
                         $error_class = null,
                         $skipmsg = false)
    {
        // The error is yet a PEAR error object
        if (is_object($message)) {
            $code        = $message->getCode();
            $userinfo    = $message->getUserInfo();
            $error_class = $message->getType();
            $message->error_message_prefix = '';
            $message     = $message->getMessage();
        }

        if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && sizeof($exp = end($this->_expected_errors))) {
            if ($exp[0] == "*" ||
                (is_int(reset($exp)) && in_array($code, $exp)) ||
                (is_string(reset($exp)) && in_array($message, $exp))) {
                $mode = PEAR_ERROR_RETURN;
            }
        }
        // No mode given, try global ones
        if ($mode === null) {
            // Class error handler
            if (isset($this) && isset($this->_default_error_mode)) {
                $mode    = $this->_default_error_mode;
                $options = $this->_default_error_options;
            // Global error handler
            } elseif (isset($GLOBALS['_PEAR_default_error_mode'])) {
                $mode    = $GLOBALS['_PEAR_default_error_mode'];
                $options = $GLOBALS['_PEAR_default_error_options'];
            }
        }

        if ($error_class !== null) {
            $ec = $error_class;
        } elseif (isset($this) && isset($this->_error_class)) {
            $ec = $this->_error_class;
        } else {
            $ec = 'PEAR_Error';
        }
        if ($skipmsg) {
            $a = &new $ec($code, $mode, $options, $userinfo);
            return $a;
        } else {
            $a = &new $ec($message, $code, $mode, $options, $userinfo);
            return $a;
        }
    }

    // }}}
    // {{{ throwError()

    /**
     * Simpler form of raiseError with fewer options.  In most cases
     * message, code and userinfo are enough.
     *
     * @param string $message
     *
     */
    function &throwError($message = null,
                         $code = null,
                         $userinfo = null)
    {
        if (isset($this) && is_a($this, 'PEAR')) {
            $a = &$this->raiseError($message, $code, null, null, $userinfo);
            return $a;
        } else {
            $a = &PEAR::raiseError($message, $code, null, null, $userinfo);
            return $a;
        }
    }

    // }}}
    function staticPushErrorHandling($mode, $options = null)
    {
        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
        $def_options = &$GLOBALS['_PEAR_default_error_options'];
        $stack[] = array($def_mode, $def_options);
        switch ($mode) {
            case PEAR_ERROR_EXCEPTION:
            case PEAR_ERROR_RETURN:
            case PEAR_ERROR_PRINT:
            case PEAR_ERROR_TRIGGER:
            case PEAR_ERROR_DIE:
            case null:
                $def_mode = $mode;
                $def_options = $options;
                break;

            case PEAR_ERROR_CALLBACK:
                $def_mode = $mode;
                // class/object method callback
                if (is_callable($options)) {
                    $def_options = $options;
                } else {
                    trigger_error("invalid error callback", E_USER_WARNING);
                }
                break;

            default:
                trigger_error("invalid error mode", E_USER_WARNING);
                break;
        }
        $stack[] = array($mode, $options);
        return true;
    }

    function staticPopErrorHandling()
    {
        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
        $setmode     = &$GLOBALS['_PEAR_default_error_mode'];
        $setoptions  = &$GLOBALS['_PEAR_default_error_options'];
        array_pop($stack);
        list($mode, $options) = $stack[sizeof($stack) - 1];
        array_pop($stack);
        switch ($mode) {
            case PEAR_ERROR_EXCEPTION:
            case PEAR_ERROR_RETURN:
            case PEAR_ERROR_PRINT:
            case PEAR_ERROR_TRIGGER:
            case PEAR_ERROR_DIE:
            case null:
                $setmode = $mode;
                $setoptions = $options;
                break;

            case PEAR_ERROR_CALLBACK:
                $setmode = $mode;
                // class/object method callback
                if (is_callable($options)) {
                    $setoptions = $options;
                } else {
                    trigger_error("invalid error callback", E_USER_WARNING);
                }
                break;

            default:
                trigger_error("invalid error mode", E_USER_WARNING);
                break;
        }
        return true;
    }

    // {{{ pushErrorHandling()

    /**
     * Push a new error handler on top of the error handler options stack. With this
     * you can easily override the actual error handler for some code and restore
     * it later with popErrorHandling.
     *
     * @param mixed $mode (same as setErrorHandling)
     * @param mixed $options (same as setErrorHandling)
     *
     * @return bool Always true
     *
     * @see PEAR::setErrorHandling
     */
    function pushErrorHandling($mode, $options = null)
    {
        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
        if (isset($this) && is_a($this, 'PEAR')) {
            $def_mode    = &$this->_default_error_mode;
            $def_options = &$this->_default_error_options;
        } else {
            $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
            $def_options = &$GLOBALS['_PEAR_default_error_options'];
        }
        $stack[] = array($def_mode, $def_options);

        if (isset($this) && is_a($this, 'PEAR')) {
            $this->setErrorHandling($mode, $options);
        } else {
            PEAR::setErrorHandling($mode, $options);
        }
        $stack[] = array($mode, $options);
        return true;
    }

    // }}}
    // {{{ popErrorHandling()

    /**
    * Pop the last error handler used
    *
    * @return bool Always true
    *
    * @see PEAR::pushErrorHandling
    */
    function popErrorHandling()
    {
        $stack = &$GLOBALS['_PEAR_error_handler_stack'];
        array_pop($stack);
        list($mode, $options) = $stack[sizeof($stack) - 1];
        array_pop($stack);
        if (isset($this) && is_a($this, 'PEAR')) {
            $this->setErrorHandling($mode, $options);
        } else {
            PEAR::setErrorHandling($mode, $options);
        }
        return true;
    }

    // }}}
    // {{{ loadExtension()

    /**
    * OS independant PHP extension load. Remember to take care
    * on the correct extension name for case sensitive OSes.
    *
    * @param string $ext The extension name
    * @return bool Success or not on the dl() call
    */
    function loadExtension($ext)
    {
        if (!extension_loaded($ext)) {
            // if either returns true dl() will produce a FATAL error, stop that
            if ((ini_get('enable_dl') != 1) || (ini_get('safe_mode') == 1)) {
                return false;
            }
            if (OS_WINDOWS) {
                $suffix = '.dll';
            } elseif (PHP_OS == 'HP-UX') {
                $suffix = '.sl';
            } elseif (PHP_OS == 'AIX') {
                $suffix = '.a';
            } elseif (PHP_OS == 'OSX') {
                $suffix = '.bundle';
            } else {
                $suffix = '.so';
            }
            return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
        }
        return true;
    }

    // }}}
}

// {{{ _PEAR_call_destructors()

function _PEAR_call_destructors()
{
    global $_PEAR_destructor_object_list;
    if (is_array($_PEAR_destructor_object_list) &&
        sizeof($_PEAR_destructor_object_list))
    {
        reset($_PEAR_destructor_object_list);
        if (@PEAR::getStaticProperty('PEAR', 'destructlifo')) {
            $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list);
        }
        while (list($k, $objref) = each($_PEAR_destructor_object_list)) {
            $classname = get_class($objref);
            while ($classname) {
                $destructor = "_$classname";
                if (method_exists($objref, $destructor)) {
                    $objref->$destructor();
                    break;
                } else {
                    $classname = get_parent_class($classname);
                }
            }
        }
        // Empty the object list to ensure that destructors are
        // not called more than once.
        $_PEAR_destructor_object_list = array();
    }

    // Now call the shutdown functions
    if (is_array($GLOBALS['_PEAR_shutdown_funcs']) AND !empty($GLOBALS['_PEAR_shutdown_funcs'])) {
        foreach ($GLOBALS['_PEAR_shutdown_funcs'] as $value) {
            call_user_func_array($value[0], $value[1]);
        }
    }
}

// }}}
/**
 * Standard PEAR error class for PHP 4
 *
 * This class is supserseded by {@link PEAR_Exception} in PHP 5
 *
 * @category   pear
 * @package    PEAR
 * @author     Stig Bakken <ssb@php.net>
 * @author     Tomas V.V. Cox <cox@idecnet.com>
 * @author     Gregory Beaver <cellog@php.net>
 * @copyright  1997-2006 The PHP Group
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
 * @version    Release: @package_version@
 * @link       http://pear.php.net/manual/en/core.pear.pear-error.php
 * @see        PEAR::raiseError(), PEAR::throwError()
 * @since      Class available since PHP 4.0.2
 */
class PEAR_Error
{
    // {{{ properties

    var $error_message_prefix = '';
    var $mode                 = PEAR_ERROR_RETURN;
    var $level                = E_USER_NOTICE;
    var $code                 = -1;
    var $message              = '';
    var $userinfo             = '';
    var $backtrace            = null;

    // }}}
    // {{{ constructor

    /**
     * PEAR_Error constructor
     *
     * @param string $message  message
     *
     * @param int $code     (optional) error code
     *
     * @param int $mode     (optional) error mode, one of: PEAR_ERROR_RETURN,
     * PEAR_ERROR_PRINT, PEAR_ERROR_DIE, PEAR_ERROR_TRIGGER,
     * PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION
     *
     * @param mixed $options   (optional) error level, _OR_ in the case of
     * PEAR_ERROR_CALLBACK, the callback function or object/method
     * tuple.
     *
     * @param string $userinfo (optional) additional user/debug info
     *
     * @access public
     *
     */
    function PEAR_Error($message = 'unknown error', $code = null,
                        $mode = null, $options = null, $userinfo = null)
    {
        if ($mode === null) {
            $mode = PEAR_ERROR_RETURN;
        }
        $this->message   = $message;
        $this->code      = $code;
        $this->mode      = $mode;
        $this->userinfo  = $userinfo;
        if (function_exists("debug_backtrace")) {
            if (@!PEAR::getStaticProperty('PEAR_Error', 'skiptrace')) {
                $this->backtrace = debug_backtrace();
            }
        }
        if ($mode & PEAR_ERROR_CALLBACK) {
            $this->level = E_USER_NOTICE;
            $this->callback = $options;
        } else {
            if ($options === null) {
                $options = E_USER_NOTICE;
            }
            $this->level = $options;
            $this->callback = null;
        }
        if ($this->mode & PEAR_ERROR_PRINT) {
            if (is_null($options) || is_int($options)) {
                $format = "%s";
            } else {
                $format = $options;
            }
            printf($format, $this->getMessage());
        }
        if ($this->mode & PEAR_ERROR_TRIGGER) {
            trigger_error($this->getMessage(), $this->level);
        }
        if ($this->mode & PEAR_ERROR_DIE) {
            $msg = $this->getMessage();
            if (is_null($options) || is_int($options)) {
                $format = "%s";
                if (substr($msg, -1) != "\n") {
                    $msg .= "\n";
                }
            } else {
                $format = $options;
            }
            die(sprintf($format, $msg));
        }
        if ($this->mode & PEAR_ERROR_CALLBACK) {
            if (is_callable($this->callback)) {
                call_user_func($this->callback, $this);
            }
        }
        if ($this->mode & PEAR_ERROR_EXCEPTION) {
            trigger_error("PEAR_ERROR_EXCEPTION is obsolete, use class PEAR_Exception for exceptions", E_USER_WARNING);
            eval('$e = new Exception($this->message, $this->code);throw($e);');
        }
    }

    // }}}
    // {{{ getMode()

    /**
     * Get the error mode from an error object.
     *
     * @return int error mode
     * @access public
     */
    function getMode() {
        return $this->mode;
    }

    // }}}
    // {{{ getCallback()

    /**
     * Get the callback function/method from an error object.
     *
     * @return mixed callback function or object/method array
     * @access public
     */
    function getCallback() {
        return $this->callback;
    }

    // }}}
    // {{{ getMessage()


    /**
     * Get the error message from an error object.
     *
     * @return  string  full error message
     * @access public
     */
    function getMessage()
    {
        return ($this->error_message_prefix . $this->message);
    }


    // }}}
    // {{{ getCode()

    /**
     * Get error code from an error object
     *
     * @return int error code
     * @access public
     */
     function getCode()
     {
        return $this->code;
     }

    // }}}
    // {{{ getType()

    /**
     * Get the name of this error/exception.
     *
     * @return string error/exception name (type)
     * @access public
     */
    function getType()
    {
        return get_class($this);
    }

    // }}}
    // {{{ getUserInfo()

    /**
     * Get additional user-supplied information.
     *
     * @return string user-supplied information
     * @access public
     */
    function getUserInfo()
    {
        return $this->userinfo;
    }

    // }}}
    // {{{ getDebugInfo()

    /**
     * Get additional debug information supplied by the application.
     *
     * @return string debug information
     * @access public
     */
    function getDebugInfo()
    {
        return $this->getUserInfo();
    }

    // }}}
    // {{{ getBacktrace()

    /**
     * Get the call backtrace from where the error was generated.
     * Supported with PHP 4.3.0 or newer.
     *
     * @param int $frame (optional) what frame to fetch
     * @return array Backtrace, or NULL if not available.
     * @access public
     */
    function getBacktrace($frame = null)
    {
        if (defined('PEAR_IGNORE_BACKTRACE')) {
            return null;
        }
        if ($frame === null) {
            return $this->backtrace;
        }
        return $this->backtrace[$frame];
    }

    // }}}
    // {{{ addUserInfo()

    function addUserInfo($info)
    {
        if (empty($this->userinfo)) {
            $this->userinfo = $info;
        } else {
            $this->userinfo .= " ** $info";
        }
    }

    // }}}
    // {{{ toString()

    /**
     * Make a string representation of this object.
     *
     * @return string a string with an object summary
     * @access public
     */
    function toString() {
        $modes = array();
        $levels = array(E_USER_NOTICE  => 'notice',
                        E_USER_WARNING => 'warning',
                        E_USER_ERROR   => 'error');
        if ($this->mode & PEAR_ERROR_CALLBACK) {
            if (is_array($this->callback)) {
                $callback = (is_object($this->callback[0]) ?
                    strtolower(get_class($this->callback[0])) :
                    $this->callback[0]) . '::' .
                    $this->callback[1];
            } else {
                $callback = $this->callback;
            }
            return sprintf('[%s: message="%s" code=%d mode=callback '.
                           'callback=%s prefix="%s" info="%s"]',
                           strtolower(get_class($this)), $this->message, $this->code,
                           $callback, $this->error_message_prefix,
                           $this->userinfo);
        }
        if ($this->mode & PEAR_ERROR_PRINT) {
            $modes[] = 'print';
        }
        if ($this->mode & PEAR_ERROR_TRIGGER) {
            $modes[] = 'trigger';
        }
        if ($this->mode & PEAR_ERROR_DIE) {
            $modes[] = 'die';
        }
        if ($this->mode & PEAR_ERROR_RETURN) {
            $modes[] = 'return';
        }
        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
                       'prefix="%s" info="%s"]',
                       strtolower(get_class($this)), $this->message, $this->code,
                       implode("|", $modes), $levels[$this->level],
                       $this->error_message_prefix,
                       $this->userinfo);
    }

    // }}}
}

/*
 * Local Variables:
 * mode: php
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 */
?>

cvs diff -r1.1.1.1 -r1.2 pkgsrc/lang/pear/files/go-pear.php (expand / switch to unified diff)

--- pkgsrc/lang/pear/files/go-pear.php 2007/05/05 21:21:47 1.1.1.1
+++ pkgsrc/lang/pear/files/go-pear.php 2009/10/29 08:29:03 1.2
@@ -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# 
91function 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');
105if (!$safe_mode) { 43if (!$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();
112ob_implicit_flush(true); 48ob_implicit_flush(true);
113define('WEBINSTALLER', ($sapi_name != 'cli' && !(substr($sapi_name,0,3)=='cgi' && !isset($_SERVER['GATEWAY_INTERFACE'])))); 49define('WEBINSTALLER', ($sapi_name != 'cli' && !(substr($sapi_name,0,3)=='cgi' && !isset($_SERVER['GATEWAY_INTERFACE']))));
114 50
115ini_set('track_errors', true); 51ini_set('track_errors', true);
116ini_set('html_errors', WEBINSTALLER); 52ini_set('html_errors', WEBINSTALLER);
117ini_set('magic_quotes_runtime', false); 53ini_set('magic_quotes_runtime', false);
118error_reporting( E_ALL & ~E_NOTICE); 54error_reporting( E_ALL & ~E_NOTICE);
119 55
120define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN')); 56define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN'));
121define('GO_PEAR_VER', '0.6.0'); 57define('GO_PEAR_VER', '1.1.2');
122 
123if (!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
135define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli' && which('cscript')); 59define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli' && which('cscript'));
136 60
137/* 61/*
138 * See bug #23069 62 * See bug #23069
139 */ 63 */
140if ( WEBINSTALLER && WINDOWS ) { 64if ( 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("
144Sorry! The PEAR installer actually does not work on Windows platform using CGI and Apache. 68Sorry! The PEAR installer actually does not work on Windows platform
145Please install the module SAPI (see http://www.php.net/manual/en/install.apache.php for the 69using CGI and Apache. Please install the module SAPI (see
146instructions) or use the CLI (cli\php.exe) in the console. 70http://www.php.net/manual/en/install.apache.php for the instructions) or
 71use the CLI (cli\php.exe) in the console.
147"); 72");
148 displayHTML('error', $msg); 73 displayHTML('error', $msg);
149 } 74 }
150} 75}
151 76
152if (WEBINSTALLER && isset($_GET['action']) && $_GET['action'] == 'img' && isset($_GET['img'])) { 77if (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
166if (function_exists("version_compare") && version_compare(phpversion(), "4.2.0",'<')) { 91if (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
168least PHP 4.2.0 for stable operation. 93least PHP 4.3.0 for stable operation.
169 94
170It may be that you have a newer version of PHP installed in your web 95It may be that you have a newer version of PHP installed in your web
171server, but an older version installed as the 'php' command. In this 96server, but an older version installed as the 'php' command. In this
172case, you need to rebuilt PHP from source. 97case, you need to rebuilt PHP from source.
173 
174If 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 
177If your source is 4.3.x or newer, just make sure you don't run 98If 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
180Please upgrade PHP to a newer version, and try again. See you then. 101Please 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 
192if (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
212if(!WEBINSTALLER && WINDOWS){ 142if(!WEBINSTALLER && WINDOWS){
213 $config_desc['php_bin'] = 'php.exe path'; 143 $config_desc['php_bin'] = 'php.exe path';
214} 144}
215 145
216if (WEBINSTALLER) { 146if (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
231register_shutdown_function('bail'); 161register_shutdown_function('bail');
232 162
233detect_install_dirs(); 163detect_install_dirs();
234 164
235if (WEBINSTALLER) { 165if (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
314if (!WEBINSTALLER) { 255if (!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 = "
324Running in local install mode 265Running in local install mode
325"; 266";
326 } elseif (WINDOWS) { 267 } elseif (WINDOWS) {
327 $local = " 268 $local = "
328Use 'php " . $_SERVER['argv'][0] . " local' to install a local copy of PEAR. 269Use '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
333Go-pear will install the 'pear' command and all the files needed by 274Go-pear will install the 'pear' command and all the files needed by
334it. This command is your tool for PEAR installation and maintenance. 275it. This command is your tool for PEAR installation and maintenance.
335$local 276$local
336Go-pear also lets you download and install the PEAR packages bundled 277Go-pear also lets you download and install the following optional PEAR
337with PHP: " . implode(', ', $pfc_packages) . ". 278packages: " . implode(', ', array_keys($pfc_packages)) . ".
338 279
339 280
340If you wish to abort, press Control-C now, or press Enter to continue: "; 281If 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...
363array_unshift($config_vars, ""); 304array_unshift($config_vars, "");
364unset($config_vars[0]); 305unset($config_vars[0]);
365reset($config_vars); 306reset($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);
369end($config_vars); 310end($config_vars);
370$last = key($config_vars); 311$last = key($config_vars);
371 312
372if (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 */
397if( WINDOWS && !WEBINSTALLER && $php_bin=='') { 318if( WINDOWS && !WEBINSTALLER && $php_bin=='') {
398 print " 319 print "
399We do not find any php.exe, please select the php.exe folder (CLI is 320We do not find any php.exe, please select the php.exe folder (CLI is
400recommanded, usually in c:\php\cli\php.exe) 321recommanded, 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
484If you have a CLI (or CGI) php.exe available, we strongly recommand to use it. 405If 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
512foreach ($config_vars as $n => $var) { 438foreach ($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 {
523if (!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 
529if (!$_found) { 
530 print " 454 print "
531 455
532****************************************************************************** 456******************************************************************************
533FATAL ERROR! We cannot initialize the temp directory. Please be sure to give 457FATAL ERROR! We cannot initialize the temp directory. Please be sure to give
534full write access to this directory and the install directory. 458full 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
548if (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 { 498Run 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 
559rm_rf($ptmp); 
560mkdir_p($ptmp, 0700); 
561$ok = @chdir($ptmp); 
562 516
563foreach ($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.
 529Run 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)) { 546if (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();
574Run 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
579if (!WEBINSTALLER) { 566if (!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
592if (function_exists('set_include_path')) { 580if (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
617print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n"; 605print "Loading zlib: ".($have_gzip ? 'ok' : 'failed')."\n";
618 606
619if (!$have_gzip) { 607if (!$have_gzip) {
620 print "Downloading uncompressed packages\n"; 608 print "Downloading uncompressed packages\n";
621}; 609};
622 610
623if ($install_pfc) { 611if ($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 
629displayHTMLProgress($progress = 5); 
630 615
631if (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();
638if ($dh) { 626if (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
652foreach ($installer_packages as $pkg) { 644print "\n".'Bootstrapping Installer...................'."\n";
653 $pkg_basename = substr($pkg, 0, strpos($pkg, '-')); 645displayHTMLProgress($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 
674print 'Bootstrapping: PEAR...................'; 
675if (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 
684include_once 'PEAR.php'; 
685print "ok\n"; 
686 
687print '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;
692mkdir('Archive', 0700); 649if (is_dir($php_dir)) {
693 650 $nobootstrap = true;
694if (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}
701print "ok\n"; 
702 655
703print 'Bootstrapping: Console_Getopt.........'; 656if ($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')) {
706mkdir('Console', 0700); 659 set_include_path($php_dir);
707if (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);
714print "ok\n"; 669
715 670 print 'Bootstrapping '.$name.'............';
716if ($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 687unset($nobootstrap, $file, $url, $name, $dir);
738displayHTMLProgress($progress = 70); 
739 688
740PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n"); 689PEAR::setErrorHandling(PEAR_ERROR_DIE, "\n%s\n");
741print 'Extracting installer..................'; 690print "\n".'Extracting installer..................'."\n";
742 691displayHTMLProgress($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
747include_once 'Archive/Tar.php'; 693// Extract needed ?
748 694$noextract = false;
749$tar = &new Archive_Tar($tarball['Structures_Graph'], $have_gzip); 695if (is_dir($php_dir)) {
750if (!$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'], '.'); 706if ($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();
759if (!$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}
762print "ok\n"; 734unset($noextract, $registry, $pkg, $tarball, $url, $fullpkg, $tar);
763 735
764$tarball['PEAR'] = 'package.xml'; // :-) 736
 737print "\n".'Preparing installer..................'."\n";
 738displayHTMLProgress($progress = 40);
765 739
766// Default for sig_bin 740// Default for sig_bin
767putenv('PHP_PEAR_SIG_BIN=""'); 741putenv('PHP_PEAR_SIG_BIN=""');
768// Default for sig_keydir 742// Default for sig_keydir
769putenv('PHP_PEAR_SIG_KEYDIR=""'); 743putenv('PHP_PEAR_SIG_KEYDIR=""');
770putenv('PHP_PEAR_DOWNLOAD_DIR=' . $temp_dir . '/download'); 744putenv('PHP_PEAR_DOWNLOAD_DIR=' . $temp_dir . '/download');
771putenv('PHP_PEAR_TEMP_DIR=' . $temp_dir); 745putenv('PHP_PEAR_TEMP_DIR=' . $temp_dir);
772 746
773include_once "PEAR.php"; 
774include_once "PEAR/Config.php"; 747include_once "PEAR/Config.php";
775include_once "PEAR/Command.php"; 748include_once "PEAR/Command.php";
776include_once "PEAR/Registry.php"; 749include_once "PEAR/Registry.php";
777 750
778if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') { 751if (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');
786foreach ($config_vars as $var) { 759foreach ($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);
794PEAR_Command::setFrontendType('CLI'); 770PEAR_Command::setFrontendType('CLI');
795$install = &PEAR_Command::factory('install', $config); 
796 771
797$install_options = array( 772PEAR::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); 775PEAR::staticPopErrorHandling(); // reset error handling
 776unset($ch_cmd);
801 777
802foreach ($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)); 779print "\n".'Installing selected packages..................'."\n";
 780displayHTMLProgress($progress = 45);
809 781
810 displayHTMLProgress($progress += round(29 / count($tarball))); 782$install = &PEAR_Command::factory('install', $config);
811} 783foreach ($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}
 813unset($pkg, $pkg_basename, $options, $bootstrap_pkgs_tarballs);
 814
 815/* TODO: Memory exhaustion in webinstaller : / (8Mb)
 816print "\n".'Making sure every package is at the latest version........';
 817$install->run('upgrade-all', array('soft' => true), array());
 818print "ok\n";
 819*/
 820unset($config, $registry, $install);
813displayHTMLProgress($progress = 99); 821displayHTMLProgress($progress = 99);
814 822
 823
815// Base installation finished 824// Base installation finished
816 825
817ini_restore("include_path"); 826ini_restore("include_path");
818 827
819if (!WEBINSTALLER) { 828if (!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'
908to see what packages are installed, or 'pear help' for help. 917to see what packages are installed, or 'pear help' for help.
909 918
910For more information about PEAR, see: 919For 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
916Thanks for using go-pear! 924Thanks for using go-pear!
917 925
918"; 926";
919 } 927 }
920} 928}
921 929
922if (WEBINSTALLER) { 930if (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
966if ( WINDOWS ) { 976if ( WINDOWS ) {
967 clearstatcache(); 977 clearstatcache();
968 @unlink($bin_dir.DIRECTORY_SEPARATOR.'.tmppear'); 978 @unlink($bin_dir.DIRECTORY_SEPARATOR.'.tmppear');
969} 979}
970 980
971if (WINDOWS && !WEBINSTALLER) { 981if (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 */
 992function 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
978function download_url($url, $destfile = null, $proxy = null) 1026function 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
1063function which($program, $dont_search_in = false) 1113function 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 = '')
1145function mkdir_p($dir, $mode = 0777) 1195function 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
1168function rm_rf($path) 1219function 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 */
1198function temp_dir($default=false) 1249function 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&amp;img=pearlogo" width="104" height="50" vspace="2" hspace="5" alt="PEAR"> 1688 <img src="<?php echo basename(__FILE__); ?>?action=img&amp;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 &nbsp; 1691 &nbsp;
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>&nbsp;<br /> 1702 <span style="color: #ffffff">Version <?php echo GO_PEAR_VER; ?></span>&nbsp;<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&amp;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&amp;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&amp;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&amp;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 &gt;&gt;</a> 1798 </p>
 1799
 1800 <a href="<?php echo basename(__FILE__); ?>?step=config&restart=1" class="green">Next &gt;&gt;</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>&nbsp;</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&amp;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&amp;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&amp;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&amp;img=note" border="0"></TD> 1939 <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&amp;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&amp;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">&nbsp;</td> 2091 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_1">&nbsp;</td>
1932 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_2">&nbsp;</td> 2092 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_2">&nbsp;</td>
1933 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_3">&nbsp;</td> 2093 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_3">&nbsp;</td>
1934 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_4">&nbsp;</td> 2094 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_4">&nbsp;</td>
1935 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_5">&nbsp;</td> 2095 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_5">&nbsp;</td>
1936 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_6">&nbsp;</td> 2096 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_6">&nbsp;</td>
1937 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_7">&nbsp;</td> 2097 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_7">&nbsp;</td>
1938 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_8">&nbsp;</td> 2098 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_8">&nbsp;</td>
1939 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_9">&nbsp;</td> 2099 <td bgcolor="#cccccc" width="10" height="20" id="progress_cell_9">&nbsp;</td>
1940 <td bgcolor="#ffffff" width="10" height="20">&nbsp;</td> 2100 <td bgcolor="#ffffff" width="10" height="20">&nbsp;</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">&nbsp;</td> 2107 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_0">&nbsp;</td>
1948 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_1">&nbsp;</td> 2108 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_1">&nbsp;</td>
1949 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_2">&nbsp;</td> 2109 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_2">&nbsp;</td>
1950 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_3">&nbsp;</td> 2110 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_3">&nbsp;</td>
1951 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_4">&nbsp;</td> 2111 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_4">&nbsp;</td>
1952 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_5">&nbsp;</td> 2112 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_5">&nbsp;</td>
1953 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_6">&nbsp;</td> 2113 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_6">&nbsp;</td>
1954 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_7">&nbsp;</td> 2114 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_7">&nbsp;</td>
1955 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_8">&nbsp;</td> 2115 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_8">&nbsp;</td>
1956 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_9">&nbsp;</td> 2116 <td bgcolor="#cccccc" width="10" height="20" id="download_progress_cell_9">&nbsp;</td>
1957 <td bgcolor="#ffffff" width="10" height="20">&nbsp;</td> 2117 <td bgcolor="#ffffff" width="10" height="20">&nbsp;</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">&nbsp;</td> 2119 <td bgcolor="#ffffff" width="10" height="20">&nbsp;</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&amp;<?php echo SID;?>" width="700" height="700" frameborder="0" marginheight="0" marginwidth="0"></iframe> 2124 <iframe src="<?php echo basename(__FILE__); ?>?step=install-progress&amp;<?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
2001function displayHTMLInstallationSummary($data = '') 2161function 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&amp;img=note" border="0"></TD> 2197 <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&amp;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&amp;img=note" border="0"></TD> 2222 <td valign="top"><img src="<?php echo basename(__FILE__); ?>?action=img&amp;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 &gt;&gt;</a> 2236 <a href="<?php echo $next;?>" class="green" target="_parent">Start Web Frontend of the PEAR Installer &gt;&gt;</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 &gt;&gt;</a> 2240 <a href="<?php echo $next;?>" class="green">Start Web Frontend of the PEAR Installer &gt;&gt;</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
2148function displayHTMLDownloadProgress($progress) 2322function 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
2165function displayHTMLSetDownload($file) 2339function 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 "
2492php.ini <$pathIni> include_path updated. 2670php.ini <$pathIni> include_path updated.
2493"; 2671";
2494 } 2672 }
2495 return true; 2673 return true;
2496} 2674}
 2675
 2676?>

cvs diff -r1.2 -r1.3 pkgsrc/lang/pear/files/Attic/pear.sh (expand / switch to unified diff)

--- pkgsrc/lang/pear/files/Attic/pear.sh 2008/12/20 14:42:50 1.2
+++ pkgsrc/lang/pear/files/Attic/pear.sh 2009/10/29 08:29:03 1.3
@@ -1,30 +1,30 @@ @@ -1,30 +1,30 @@
1#!@SH@ 1#!@SH@
2# 2#
3# $Id: pear.sh,v 1.2 2008/12/20 14:42:50 adrianp Exp $ 3# $Id: pear.sh,v 1.3 2009/10/29 08:29:03 seb Exp $
4 4
5# first find which PHP binary to use 5# first find which PHP binary to use
6if test "x$PHP_PEAR_PHP_BIN" != "x"; then 6if test "x$PHP_PEAR_PHP_BIN" != "x"; then
7 PHP="$PHP_PEAR_PHP_BIN" 7 PHP="$PHP_PEAR_PHP_BIN"
8else 8else
9 if test "@php_bin@" = '@'php_bin'@'; then 9 if test "@php_bin@" = '@'php_bin'@'; then
10 PHP=php  10 PHP=php
11 else 11 else
12 PHP="@php_bin@" 12 PHP="@php_bin@"
13 fi 13 fi
14fi 14fi
15 15
16# then look for the right pear include dir 16# then look for the right pear include dir
17if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then 17if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
18 INCDIR=$PHP_PEAR_INSTALL_DIR 18 INCDIR=$PHP_PEAR_INSTALL_DIR
19 INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR" 19 INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
20else 20else
21 if test "@php_dir@" = '@'php_dir'@'; then 21 if test "@php_dir@" = '@'php_dir'@'; then
22 INCDIR=`dirname $0` 22 INCDIR=`dirname $0`
23 INCARG=""  23 INCARG=""
24 else 24 else
25 INCDIR="@php_dir@" 25 INCDIR="@php_dir@"
26 INCARG="-d include_path=@php_dir@" 26 INCARG="-d include_path=@php_dir@"
27 fi 27 fi
28fi 28fi
29 29
30exec $PHP -C -q $INCARG -d output_buffering=1 -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@" 30exec $PHP -C -q $INCARG -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"

cvs diff -r1.3 -r1.4 pkgsrc/lang/pear/patches/Attic/patch-aa (expand / switch to unified diff)

--- pkgsrc/lang/pear/patches/Attic/patch-aa 2008/09/15 11:54:21 1.3
+++ pkgsrc/lang/pear/patches/Attic/patch-aa 2009/10/29 08:29:03 1.4
@@ -1,152 +1,168 @@ @@ -1,152 +1,168 @@
1$NetBSD: patch-aa,v 1.3 2008/09/15 11:54:21 adrianp Exp $ 1$NetBSD: patch-aa,v 1.4 2009/10/29 08:29:03 seb Exp $
2 2
3--- install/go-pear.php.orig 2008-09-15 12:40:50.000000000 +0100 3--- install/go-pear.php.orig 2009-10-17 09:56:43.000000000 +0000
4+++ install/go-pear.php 4+++ install/go-pear.php
5@@ -311,6 +311,8 @@ if (WEBINSTALLER) { 5@@ -252,6 +252,8 @@ if (WEBINSTALLER) {
6 $install_pfc = $_SESSION['go-pear']['install_pfc']; 6 // Anything past this step has something to do with the installation
7 } 7 }
8  8
9+/* 9+/*
10+ 10+
11 if (!WEBINSTALLER) { 11 if (!WEBINSTALLER) {
12 $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r'); 12 $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r');
13  13
14@@ -355,6 +357,8 @@ If you wish to abort, press Control-C no 14@@ -296,6 +298,8 @@ If you wish to abort, press Control-C no
15 } 15 }
16 } 16 }
17  17
18+*/ 18+*/
19+ 19+
20 $origpwd = getcwd(); 20 $origpwd = getcwd();
21  21
22 $config_vars = array_keys($config_desc); 22 $config_vars = array_keys($config_desc);
23@@ -426,6 +430,8 @@ we strongly recommand to use it. 23@@ -347,6 +351,8 @@ we strongly recommand to use it.
24 } 24 }
25 } 25 }
26  26
27+/* 27+/*
28+ 28+
29 while (!WEBINSTALLER) { 29 while (!WEBINSTALLER) {
30 print " 30 print "
31 Below is a suggested file layout for your new PEAR installation. To 31 Below is a suggested file layout for your new PEAR installation. To
32@@ -509,6 +515,8 @@ If you have a CLI (or CGI) php.exe avail 32@@ -430,6 +436,8 @@ If you have a CLI (or CGI) php.exe avail
33 } 33 }
34 } 34 }
35  35
36+*/ 36+*/
37+ 37+
38 foreach ($config_vars as $n => $var) { 38 ####
39 for ($m = 1; $m <= count($config_vars); $m++) { 39 # Installation stuff
40 $var2 = $config_vars[$m]; 40 ####
41@@ -576,6 +584,8 @@ Run this script as $root or pick another 41@@ -564,13 +572,17 @@ if (WEBINSTALLER) {
42 } 
43 } 42 }
44  43
45+/* 
46+ 
47 if (!WEBINSTALLER) { 44 if (!WEBINSTALLER) {
 45+/*
48 $msg = "The following PEAR packages are bundled with PHP: " . 46 $msg = "The following PEAR packages are bundled with PHP: " .
49 implode(', ', $pfc_packages); 47 implode(', ', array_keys($pfc_packages));
50@@ -585,6 +595,8 @@ if (!WEBINSTALLER) { 48 print "\n" . wordwrap($msg, 75) . ".\n";
 49 print "Would you like to install these as well? [Y/n] : ";
 50 $install_pfc = !stristr(fgets($tty, 1024), "n");
 51+*/
 52 $install_optional_packages = array();
 53+/*
51 print "\n"; 54 print "\n";
 55+*/
52 } 56 }
53  57
54+*/ 
55+ 
56 #### 
57 # Download 
58 #### 58 ####
59@@ -595,6 +607,8 @@ if (function_exists('set_include_path')) 59@@ -583,6 +595,8 @@ if (function_exists('set_include_path'))
60 ini_set('include_path', $ptmp); 60 ini_set('include_path', $ptmp);
61 } 61 }
62  62
63+/* 63+/*
64+ 64+
65 if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could be in multithread env which makes dl() end up with a fatal error. 65 if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could be in multithread env which makes dl() end up with a fatal error.
66 if (WINDOWS) { 66 if (WINDOWS) {
67 @dl('php_zlib.dll'); 67 @dl('php_zlib.dll');
68@@ -620,6 +634,8 @@ if (!$have_gzip) { 68@@ -608,6 +622,8 @@ if (!$have_gzip) {
69 print "Downloading uncompressed packages\n"; 69 print "Downloading uncompressed packages\n";
70 }; 70 };
71  71
72+*/ 72+*/
73+ 73+
74 if ($install_pfc) { 74 if ($install_pfc) {
75 $to_install = array_merge($installer_packages, $pfc_packages); 75 $to_install = array_merge($installer_packages, array_keys($pfc_packages));
76 } else { 76 } else {
77@@ -776,7 +792,7 @@ include_once "PEAR/Command.php"; 77@@ -749,7 +765,7 @@ include_once "PEAR/Command.php";
78 include_once "PEAR/Registry.php"; 78 include_once "PEAR/Registry.php";
79  79
80 if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') { 80 if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
81- $config = &PEAR_Config::singleton($prefix."/pear.conf", ''); 81- $config = &PEAR_Config::singleton($prefix."/pear.conf", '');
82+ $config = &PEAR_Config::singleton("@WRKSRC@"."/pear.conf", ''); 82+ $config = &PEAR_Config::singleton("@WRKSRC@"."/pear.conf", '');
83 } else { 83 } else {
84 $config = &PEAR_Config::singleton(); 84 $config = &PEAR_Config::singleton();
85 } 85 }
86@@ -810,10 +826,17 @@ foreach ($tarball as $pkg => $src) { 86@@ -781,7 +797,11 @@ displayHTMLProgress($progress = 45);
87 displayHTMLProgress($progress += round(29 / count($tarball))); 
88 } 
89  87
 88 $install = &PEAR_Command::factory('install', $config);
 89 foreach ($to_install as $pkg) {
 90- $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
 91+ if (strpos($pkg, '-')) {
 92+ $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
 93+ } else {
 94+ $pkg_basename = $pkg;
 95+ }
 96
 97 if (in_array($pkg, $installer_packages)) {
 98 $options = array('nodeps' => true);
 99@@ -794,7 +814,6 @@ foreach ($to_install as $pkg) {
 100 continue;
 101 }
 102
 103- $pkg_basename = substr($pkg, 0, strpos($pkg, '-'));
 104 if (in_array($pkg_basename, $bootstrap_pkgs)) {
 105 print(str_pad("Installing bootstrap package: $pkg_basename", max(50,30+strlen($pkg_basename)+4), '.')."...");
 106 displayHTMLProgress($progress += round(25 / count($to_install)));
 107@@ -817,12 +836,17 @@ print "\n".'Making sure every package is
 108 $install->run('upgrade-all', array('soft' => true), array());
 109 print "ok\n";
 110 */
90+$config->set('download_dir', '/tmp' . '/download'); 111+$config->set('download_dir', '/tmp' . '/download');
91+$config->set('temp_dir', '/tmp'); 112+$config->set('temp_dir', '/tmp');
92+$config->store(); 113+$config->store();
93+$install = &PEAR_Command::factory('install', $config); 114 unset($config, $registry, $install);
94+ 
95 displayHTMLProgress($progress = 99); 115 displayHTMLProgress($progress = 99);
96  116
 117
97 // Base installation finished 118 // Base installation finished
98  119
99+/* 120+/*
100+ 121+
101 ini_restore("include_path"); 122 ini_restore("include_path");
102  123
103 if (!WEBINSTALLER) { 124 if (!WEBINSTALLER) {
104@@ -971,6 +994,9 @@ if ( WINDOWS ) { 125@@ -981,6 +1005,9 @@ if ( WINDOWS ) {
105 if (WINDOWS && !WEBINSTALLER) { 126 if (WINDOWS && !WEBINSTALLER) {
106 win32CreateRegEnv(); 127 win32CreateRegEnv();
107 } 128 }
108+ 129+
109+*/ 130+*/
110+ 131+
111 // Set of functions following 132 // Set of functions following
112  133 /**
113 // {{{ download_url() 134 * Parse the given dirname
114@@ -1367,16 +1393,18 @@ function detect_install_dirs($_prefix =  135@@ -1420,17 +1447,19 @@ function detect_install_dirs($_prefix =
115 } 
116 } else { 136 } else {
117 if ($_prefix === null) { 137 if ($_prefix === null) {
118- $prefix = dirname(PHP_BINDIR); 138 #$prefix = dirname(PHP_BINDIR);
 139- $prefix = dirname(__FILE__);
119+ $prefix = "@PREFIX@"; 140+ $prefix = "@PREFIX@";
120 } else { 141 } else {
121 $prefix = $_prefix; 142 $prefix = $_prefix;
122 } 143 }
123 $bin_dir = '$prefix/bin'; 144 $bin_dir = '$prefix/bin';
124- $php_dir = '$prefix/share/pear'; 145 #$php_dir = '$prefix/share/pear';
 146- $php_dir = '$prefix/PEAR';
125- $doc_dir = '$php_dir/docs'; 147- $doc_dir = '$php_dir/docs';
126+ $php_dir = '$prefix/lib/php'; 148+ $php_dir = '$prefix/lib/php';
127+ $doc_dir = '$php_dir/doc'; 149+ $doc_dir = '$php_dir/doc';
128 $data_dir = '$php_dir/data'; 150 $data_dir = '$php_dir/data';
129- $test_dir = '$php_dir/tests'; 151- $test_dir = '$php_dir/tests';
130- $temp_dir = '$prefix/temp'; 152- $temp_dir = '$prefix/temp';
131+ $test_dir = '$php_dir/test'; 153+ $test_dir = '$php_dir/test';
132+ $temp_dir = '@WRKSRC@/tmp'; 154+ $temp_dir = '@WRKSRC@/tmp';
133+ 155+
134+/* 156+/*
135  157
136 // check if the user has installed PHP with PHP or GNU layout 158 // check if the user has installed PHP with PHP or GNU layout
137 if (@is_dir("$prefix/lib/php/.registry")) { 159 if (@is_dir("$prefix/lib/php/.registry")) {
138@@ -1389,6 +1417,9 @@ function detect_install_dirs($_prefix =  160@@ -1443,6 +1472,8 @@ function detect_install_dirs($_prefix =
139 } elseif (@is_dir("$prefix/share/php/.registry")) { 161 } elseif (@is_dir("$prefix/share/php/.registry")) {
140 $php_dir = '$prefix/share/php'; 162 $php_dir = '$prefix/share/php';
141 } 163 }
142+ 
143+*/ 164+*/
144+ 165+
145 } 166 }
146 } 167 }
147  168
148@@ -2494,3 +2525,4 @@ php.ini <$pathIni> include_path updated. 
149 } 
150 return true; 
151 } 
152+?>