com web/qa: No ../.. hacks: list_builds.php
| From: | Rasmus Lerdorf | Date: | Thu, 21 Jun 2018 04:26:36 +0000 |
| Subject: | com web/qa: No ../.. hacks: list_builds.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-68098@lists.php.net to get a copy of this message | ||
Commit: 9e20078128d975ac396665f0ac4da1e7e2731871
Author: Rasmus Lerdorf <rasmus@lerdorf.com> Wed, 20 Jun 2018 21:26:36 -0700
Parents: ab9bc8d68b7e6082f6bb74a2d08c8e8e7a75be3c
Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=9e20078128d975ac396665f0ac4da1e7e2731871
Log:
No ../.. hacks
Changed paths:
M list_builds.php
Diff:
diff --git a/list_builds.php b/list_builds.php
index e8a06f3..3439e06 100755
--- a/list_builds.php
+++ b/list_builds.php
@@ -1,97 +1,97 @@
-<?php
-define('BASE_REPORT_DIR',
dirname($_SERVER['SCRIPT_FILENAME'])."/reports/db/");
-
-$branch = $_GET['branch'];
-if (substr($branch, 0, 3)!='PHP') {
- $branch = "PHP_5_6";
-}
-
-
-include("include/functions.php");
-
-$TITLE = "PHP: QA: PFTT: $branch";
-$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
-/* $Id$ */
-
-common_header(NULL, $TITLE);
-
-?>
-<h1><a href="pftt.php"><?php echo htmlentities($branch);
?></a></h1>
-
-<p>Choose a PHP revision or build</p>
-<?php
-
-$r = scandir(BASE_REPORT_DIR."/$branch");
-
-
-if ($r!==FALSE) {
-sort($r);
-
-$latest_revision = '';
-$mtime = 0;
-
-$revisions_by_mtime = array();
-
-foreach ( $r as $revision ) {
- if ($revision=="." or $revision=="..")
- continue;
- if (is_dir(BASE_REPORT_DIR."/$branch/$revision")) {
- $s = stat(BASE_REPORT_DIR."/$branch/$revision");
- $mtime = $s['mtime'];
- if ($mtime > $latest_revision_mtime) {
- $latest_revision = $revision;
- $latest_revision_mtime = $mtime;
- }
- $revisions_by_mtime[$mtime] = $revision;
- }
-} // end foreach
-
-$mtimes = array_keys($revisions_by_mtime);
-
-sort($mtimes);
-
-$revisions = array();
-
-foreach ($mtimes as $mtime) {
- array_push($revisions, $revisions_by_mtime[$mtime]);
-}
-
-$red = is_file(BASE_REPORT_DIR."/$branch/$latest_revision/FAIL_CRASH.txt");
-
-?>
-<table class="pftt" style="background:<?php echo $red ? '#ff0000' :
'#ccff66'; ?>">
- <tr>
- <td>Latest:</td>
- <td><a href="build.php?branch=<?php echo urlencode($branch);
?>&revision=<?php echo urlencode($latest_revision); ?>"><?php echo
htmlentities($latest_revision); ?></a></td>
- </tr>
-</table>
-<br/>
-<table class="pftt">
- <?php
-
-$revisions = array_reverse($revisions);
-
-foreach ( $revisions as $revision ) {
- $red = is_file(BASE_REPORT_DIR."/$branch/$revision/FAIL_CRASH.txt");
-
- ?>
- <tr style="background:<?php echo $red ? '#ff0000' : '#ccff66';
?>">
- <td><a href="build.php?branch=<?php echo urlencode($branch);
?>&revision=<?php echo urlencode($revision); ?>"><?php echo
htmlentities($revision); ?></a></td>
- </tr>
- <?php
-
-} // end foreach
-
-
- ?>
-</table>
-<br/>
-<br/>
-<?php
-
-} // end if
-
-
-common_footer();
-
-?>
+<?php
+define('BASE_REPORT_DIR',
dirname($_SERVER['SCRIPT_FILENAME'])."/reports/db/");
+
+$branch = $_GET['branch'];
+if (substr($branch, 0, 3)!='PHP') {
+ $branch = "PHP_5_6";
+}
+$branch = preg_replace("#\.\./|\.\.#","",$branch);
+
+include("include/functions.php");
+
+$TITLE = "PHP: QA: PFTT: $branch";
+$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
+/* $Id$ */
+
+common_header(NULL, $TITLE);
+
+?>
+<h1><a href="pftt.php"><?php echo htmlentities($branch);
?></a></h1>
+
+<p>Choose a PHP revision or build</p>
+<?php
+
+$r = scandir(BASE_REPORT_DIR."/$branch");
+
+
+if ($r!==FALSE) {
+sort($r);
+
+$latest_revision = '';
+$mtime = 0;
+
+$revisions_by_mtime = array();
+
+foreach ( $r as $revision ) {
+ if ($revision=="." or $revision=="..")
+ continue;
+ if (is_dir(BASE_REPORT_DIR."/$branch/$revision")) {
+ $s = stat(BASE_REPORT_DIR."/$branch/$revision");
+ $mtime = $s['mtime'];
+ if ($mtime > $latest_revision_mtime) {
+ $latest_revision = $revision;
+ $latest_revision_mtime = $mtime;
+ }
+ $revisions_by_mtime[$mtime] = $revision;
+ }
+} // end foreach
+
+$mtimes = array_keys($revisions_by_mtime);
+
+sort($mtimes);
+
+$revisions = array();
+
+foreach ($mtimes as $mtime) {
+ array_push($revisions, $revisions_by_mtime[$mtime]);
+}
+
+$red = is_file(BASE_REPORT_DIR."/$branch/$latest_revision/FAIL_CRASH.txt");
+
+?>
+<table class="pftt" style="background:<?php echo $red ? '#ff0000' :
'#ccff66'; ?>">
+ <tr>
+ <td>Latest:</td>
+ <td><a href="build.php?branch=<?php echo urlencode($branch);
?>&revision=<?php echo urlencode($latest_revision); ?>"><?php echo
htmlentities($latest_revision); ?></a></td>
+ </tr>
+</table>
+<br/>
+<table class="pftt">
+ <?php
+
+$revisions = array_reverse($revisions);
+
+foreach ( $revisions as $revision ) {
+ $red = is_file(BASE_REPORT_DIR."/$branch/$revision/FAIL_CRASH.txt");
+
+ ?>
+ <tr style="background:<?php echo $red ? '#ff0000' : '#ccff66';
?>">
+ <td><a href="build.php?branch=<?php echo urlencode($branch);
?>&revision=<?php echo urlencode($revision); ?>"><?php echo
htmlentities($revision); ?></a></td>
+ </tr>
+ <?php
+
+} // end foreach
+
+
+ ?>
+</table>
+<br/>
+<br/>
+<?php
+
+} // end if
+
+
+common_footer();
+
+?>