Subversion Repositories Applications.gtt

Rev

Rev 94 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 187
Line 2... Line 2...
2
/**
2
/**
3
 * PEAR_PackageFile_v1, package.xml version 1.0
3
 * PEAR_PackageFile_v1, package.xml version 1.0
4
 *
4
 *
5
 * PHP versions 4 and 5
5
 * PHP versions 4 and 5
6
 *
6
 *
7
 * LICENSE: This source file is subject to version 3.0 of the PHP license
-
 
8
 * that is available through the world-wide-web at the following URI:
-
 
9
 * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
-
 
10
 * the PHP License and are unable to obtain it through the web, please
-
 
11
 * send a note to license@php.net so we can mail you a copy immediately.
-
 
12
 *
-
 
13
 * @category   pear
7
 * @category   pear
14
 * @package    PEAR
8
 * @package    PEAR
15
 * @author     Greg Beaver <cellog@php.net>
9
 * @author     Greg Beaver <cellog@php.net>
16
 * @copyright  1997-2006 The PHP Group
10
 * @copyright  1997-2009 The Authors
17
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
11
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
18
 * @version    CVS: $Id: v1.php,v 1.72 2006/10/31 02:54:41 cellog Exp $
-
 
19
 * @link       http://pear.php.net/package/PEAR
12
 * @link       http://pear.php.net/package/PEAR
20
 * @since      File available since Release 1.4.0a1
13
 * @since      File available since Release 1.4.0a1
21
 */
14
 */
22
/**
15
/**
23
 * For error handling
16
 * For error handling
Line 277... Line 270...
277
/**
270
/**
278
 * package.xml encapsulator
271
 * package.xml encapsulator
279
 * @category   pear
272
 * @category   pear
280
 * @package    PEAR
273
 * @package    PEAR
281
 * @author     Greg Beaver <cellog@php.net>
274
 * @author     Greg Beaver <cellog@php.net>
282
 * @copyright  1997-2006 The PHP Group
275
 * @copyright  1997-2009 The Authors
283
 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
276
 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
284
 * @version    Release: 1.5.1
277
 * @version    Release: 1.10.1
285
 * @link       http://pear.php.net/package/PEAR
278
 * @link       http://pear.php.net/package/PEAR
286
 * @since      Class available since Release 1.4.0a1
279
 * @since      Class available since Release 1.4.0a1
287
 */
280
 */
288
class PEAR_PackageFile_v1
281
class PEAR_PackageFile_v1
289
{
282
{
Line 350... Line 343...
350
 
343
 
351
    /**
344
    /**
352
     * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack
345
     * @param bool determines whether to return a PEAR_Error object, or use the PEAR_ErrorStack
353
     * @param string Name of Error Stack class to use.
346
     * @param string Name of Error Stack class to use.
354
     */
347
     */
355
    function PEAR_PackageFile_v1()
348
    function __construct()
356
    {
349
    {
357
        $this->_stack = &new PEAR_ErrorStack('PEAR_PackageFile_v1');
350
        $this->_stack = new PEAR_ErrorStack('PEAR_PackageFile_v1');
358
        $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
351
        $this->_stack->setErrorMessageTemplate($this->_getErrorMessage());
359
        $this->_isValid = 0;
352
        $this->_isValid = 0;
Line 360... Line 353...
360
    }
353
    }
Line 1198... Line 1191...
1198
                    continue;
1191
                    continue;
1199
                } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) {
1192
                } elseif (!in_array($fa['role'], PEAR_Common::getFileRoles())) {
1200
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
1193
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE,
1201
                        array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
1194
                        array('file' => $file, 'role' => $fa['role'], 'roles' => PEAR_Common::getFileRoles()));
1202
                }
1195
                }
1203
                if ($file{0} == '.' && $file{1} == '/') {
1196
                if (preg_match('~/\.\.?(/|\\z)|^\.\.?/~', str_replace('\\', '/', $file))) {
-
 
1197
                    // file contains .. parent directory or . cur directory references
1204
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
1198
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
1205
                        array('file' => $file));
1199
                        array('file' => $file));
1206
                }
1200
                }
-
 
1201
                if (isset($fa['install-as']) &&
-
 
1202
                      preg_match('~/\.\.?(/|\\z)|^\.\.?/~', 
-
 
1203
                                 str_replace('\\', '/', $fa['install-as']))) {
-
 
1204
                    // install-as contains .. parent directory or . cur directory references
-
 
1205
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
-
 
1206
                        array('file' => $file . ' [installed as ' . $fa['install-as'] . ']'));
-
 
1207
                }
-
 
1208
                if (isset($fa['baseinstalldir']) &&
-
 
1209
                      preg_match('~/\.\.?(/|\\z)|^\.\.?/~', 
-
 
1210
                                 str_replace('\\', '/', $fa['baseinstalldir']))) {
-
 
1211
                    // install-as contains .. parent directory or . cur directory references
-
 
1212
                    $this->_validateError(PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME,
-
 
1213
                        array('file' => $file . ' [baseinstalldir ' . $fa['baseinstalldir'] . ']'));
-
 
1214
                }
1207
            }
1215
            }
1208
        }
1216
        }
1209
        if (isset($this->_registry) && $this->_isValid) {
1217
        if (isset($this->_registry) && $this->_isValid) {
1210
            $chan = $this->_registry->getChannel('pear.php.net');
1218
            $chan = $this->_registry->getChannel('pear.php.net');
1211
            if (PEAR::isError($chan)) {
1219
            if (PEAR::isError($chan)) {
Line 1297... Line 1305...
1297
    function &getDefaultGenerator()
1305
    function &getDefaultGenerator()
1298
    {
1306
    {
1299
        if (!class_exists('PEAR_PackageFile_Generator_v1')) {
1307
        if (!class_exists('PEAR_PackageFile_Generator_v1')) {
1300
            require_once 'PEAR/PackageFile/Generator/v1.php';
1308
            require_once 'PEAR/PackageFile/Generator/v1.php';
1301
        }
1309
        }
1302
        $a = &new PEAR_PackageFile_Generator_v1($this);
1310
        $a = new PEAR_PackageFile_Generator_v1($this);
1303
        return $a;
1311
        return $a;
1304
    }
1312
    }
Line 1305... Line 1313...
1305
 
1313
 
1306
    /**
1314
    /**
Line 1320... Line 1328...
1320
            }
1328
            }
1321
        } else { // tgz
1329
        } else { // tgz
1322
            if (!class_exists('Archive_Tar')) {
1330
            if (!class_exists('Archive_Tar')) {
1323
                require_once 'Archive/Tar.php';
1331
                require_once 'Archive/Tar.php';
1324
            }
1332
            }
1325
            $tar = &new Archive_Tar($this->_archiveFile);
1333
            $tar = new Archive_Tar($this->_archiveFile);
1326
            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
1334
            $tar->pushErrorHandling(PEAR_ERROR_RETURN);
1327
            if ($file != 'package.xml' && $file != 'package2.xml') {
1335
            if ($file != 'package.xml' && $file != 'package2.xml') {
1328
                $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
1336
                $file = $this->getPackage() . '-' . $this->getVersion() . '/' . $file;
1329
            }
1337
            }
1330
            $file = $tar->extractInString($file);
1338
            $file = $tar->extractInString($file);
Line 1455... Line 1463...
1455
                case T_EXTENDS:
1463
                case T_EXTENDS:
1456
                case T_IMPLEMENTS:
1464
                case T_IMPLEMENTS:
1457
                    $look_for = $token;
1465
                    $look_for = $token;
1458
                    continue 2;
1466
                    continue 2;
1459
                case T_STRING:
1467
                case T_STRING:
1460
                    if (version_compare(zend_version(), '2.0', '<')) {
-
 
1461
                        if (in_array(strtolower($data),
-
 
1462
                            array('public', 'private', 'protected', 'abstract',
-
 
1463
                                  'interface', 'implements', 'throw') 
-
 
1464
                                 )) {
-
 
1465
                            $this->_validateWarning(PEAR_PACKAGEFILE_ERROR_PHP5,
-
 
1466
                                array($file));
-
 
1467
                        }
-
 
1468
                    }
-
 
1469
                    if ($look_for == T_CLASS) {
1468
                    if ($look_for == T_CLASS) {
1470
                        $current_class = $data;
1469
                        $current_class = $data;
1471
                        $current_class_level = $brace_level;
1470
                        $current_class_level = $brace_level;
1472
                        $declared_classes[] = $current_class;
1471
                        $declared_classes[] = $current_class;
1473
                    } elseif ($look_for == T_INTERFACE) {
1472
                    } elseif ($look_for == T_INTERFACE) {