svn: /pear2/sandbox/pear2.php.net/trunk/ index.php
| From: | Amir Mohammad Saied | Date: | Fri, 11 Dec 2009 18:31:41 +0000 |
| Subject: | svn: /pear2/sandbox/pear2.php.net/trunk/ index.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9103@lists.php.net to get a copy of this message | ||
amir Fri, 11 Dec 2009 18:31:41 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291999
Log:
Get the version number as well as the package name from URI
Changed paths:
U pear2/sandbox/pear2.php.net/trunk/index.php
Modified: pear2/sandbox/pear2.php.net/trunk/index.php
===================================================================
--- pear2/sandbox/pear2.php.net/trunk/index.php 2009-12-11 18:29:12 UTC (rev 291998)
+++ pear2/sandbox/pear2.php.net/trunk/index.php 2009-12-11 18:31:41 UTC (rev 291999)
@@ -4,9 +4,15 @@
$options = $_GET;
if (isset($_SERVER['REDIRECT_URL'])) {
- $options['view'] = 'package';
- $options['package'] = substr($_SERVER['REDIRECT_URL'],
- strrpos($_SERVER['REDIRECT_URL'], '/'));
+ $options['view'] = 'package';
+ preg_match('/\/(?<package>[0-9a-z_]+)(-(?<version>[0-9ab.]+))?$/i',
+ $_SERVER['REDIRECT_URL'], $matches);
+ $options['package'] = $matches['package'];
+
+ if (isset($matches['version'])) {
+ $options['packageVersion'] = $matches['version'];
+ $options['view'] = 'release';
+ }
}
$channel = new \pear2\Pyrus\ChannelFile(__DIR__ . '/channel.xml');