svn: /web/qa/trunk/ include/functions.php reports/details.php reports/index.php reports/parserfunc.php reports/viewreports.php
| From: | Philip Olson | Date: | Thu, 16 Jun 2011 23:59:57 +0000 |
| Subject: | svn: /web/qa/trunk/ include/functions.php reports/details.php reports/index.php reports/parserfunc.php reports/viewreports.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-65819@lists.php.net to get a copy of this message | ||
philip Thu, 16 Jun 2011 23:59:57 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312220
Log:
Updated last commit. The PHP version check is in many places, so it's now consolidated. See
also @todo.
Changed paths:
U web/qa/trunk/include/functions.php
U web/qa/trunk/reports/details.php
U web/qa/trunk/reports/index.php
U web/qa/trunk/reports/parserfunc.php
U web/qa/trunk/reports/viewreports.php
Modified: web/qa/trunk/include/functions.php
===================================================================
--- web/qa/trunk/include/functions.php 2011-06-16 23:03:41 UTC (rev 312219)
+++ web/qa/trunk/include/functions.php 2011-06-16 23:59:57 UTC (rev 312220)
@@ -162,4 +162,17 @@
$buffer .= "</a>";
return $buffer;
}
-?>
\ No newline at end of file
+
+function is_valid_php_version($version, $QA_RELEASES = array()) {
+
+ if (isset($QA_RELEASES['reported']) && in_array($version,
$QA_RELEASES['reported'])) {
+ return true;
+ }
+
+ //@todo Add alpha/beta/RC for regex...
+ if (preg_match('@^[0-9]{1}\.[0-9]{1}\.[0-9\.\-dev]{1,}$@', $version)) {
+ return true;
+ }
+
+ return false;
+}
Modified: web/qa/trunk/reports/details.php
===================================================================
--- web/qa/trunk/reports/details.php 2011-06-16 23:03:41 UTC (rev 312219)
+++ web/qa/trunk/reports/details.php 2011-06-16 23:59:57 UTC (rev 312220)
@@ -18,12 +18,14 @@
$startTime = microtime(true);
include "../include/functions.php";
+include "../include/release-qa.php";
// sanitize
if (!preg_match('@^[a-z0-9]{32}$@', $_GET['signature'])) {
exit('Invalid signature');
}
-if (!preg_match('@^[0-9]{1}\.[0-9]{1}\.[0-9\.\-dev]{1,}$@', $_GET['version']))
{
+
+if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
exit('invalid version');
}
Modified: web/qa/trunk/reports/index.php
===================================================================
--- web/qa/trunk/reports/index.php 2011-06-16 23:03:41 UTC (rev 312219)
+++ web/qa/trunk/reports/index.php 2011-06-16 23:59:57 UTC (rev 312220)
@@ -19,12 +19,13 @@
$startTime = microtime(true);
include "../include/functions.php";
+include "../include/release-qa.php";
$TITLE = "PHP Test reports Summary";
if (isset($_GET['version'])) {
//sanity check
- if (!preg_match('@^[0-9]{1}\.[0-9]{1}\.[0-9\.\-dev]{1,}$@',
$_GET['version'])) {
+ if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
exit('invalid version');
}
$VERSION = $_GET['version'];
Modified: web/qa/trunk/reports/parserfunc.php
===================================================================
--- web/qa/trunk/reports/parserfunc.php 2011-06-16 23:03:41 UTC (rev 312219)
+++ web/qa/trunk/reports/parserfunc.php 2011-06-16 23:59:57 UTC (rev 312220)
@@ -36,12 +36,10 @@
else
die('status unknown: '.$array['status']);
- //@todo Consider alpha/beta/RC for regex
- if (!in_array($array['version'], $QA_RELEASES['reported'])) {
- if (!preg_match('@^[0-9]{1}\.[0-9]{1}\.[0-9\.\-dev]{1,}$@',
$array['version'])) {
- return;
- }
- }
+ if (!is_valid_php_version($array['version'], $QA_RELEASES)) {
+ exit('invalid version');
+ }
+
$DBFILE =
dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
if (!file_exists($DBFILE)) {
Modified: web/qa/trunk/reports/viewreports.php
===================================================================
--- web/qa/trunk/reports/viewreports.php 2011-06-16 23:03:41 UTC (rev 312219)
+++ web/qa/trunk/reports/viewreports.php 2011-06-16 23:59:57 UTC (rev 312220)
@@ -18,12 +18,14 @@
$startTime = microtime(true);
include "../include/functions.php";
+include "../include/release-qa.php";
// sanitize
if (!preg_match('@^[a-zA-Z\.0-9\-_/]{1,}$@', $_GET['test'])) {
exit('Invalid test');
}
-if (!preg_match('@^[0-9]{1}\.[0-9]{1}\.[0-9\.\-dev]{1,}$@', $_GET['version']))
{
+
+if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
exit('invalid version');
}