summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2008-11-26 20:21:39 +0000
committerAndy Staudacher <andy.st@gmail.com>2008-11-26 20:21:39 +0000
commit38e1eef5474dbe1768938fdd3882cf0627d7e70e (patch)
treeb0b488edbce7e231a46ccf07ddd0a195038b17de
parent25b0dff45cf0776ebee4aeadfe05d0977d03eb0d (diff)
Some code audit fixes and adding some directory separator normalization code to make it work on Windows as well.
-rw-r--r--core/config/locale.php21
-rw-r--r--core/tests/File_Structure_Test.php8
2 files changed, 25 insertions, 4 deletions
diff --git a/core/config/locale.php b/core/config/locale.php
index f93df409..d9f95664 100644
--- a/core/config/locale.php
+++ b/core/config/locale.php
@@ -1,4 +1,23 @@
-<?php defined('SYSPATH') or die('No direct access allowed.');
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2008 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
/**
* @package Core
*
diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php
index 0ffa0f9f..861a764c 100644
--- a/core/tests/File_Structure_Test.php
+++ b/core/tests/File_Structure_Test.php
@@ -41,7 +41,8 @@ class File_Structure_Test extends Unit_Test_Case {
}
if (strpos($file, "views")) {
$this->assert_true(
- preg_match("#/views/.*?(\.html|mrss)\.php$#", $file->getPathname()),
+ preg_match("#/views/.*?(\.html|mrss)\.php$#",
+ strtr($file->getPathname(), DIRECTORY_SEPARATOR, '/')),
"{$file->getPathname()} should end in .html.php or mrss.php");
}
}
@@ -65,7 +66,7 @@ class File_Structure_Test extends Unit_Test_Case {
$expected = $this->_get_preamble(__FILE__);
foreach ($dir as $file) {
- if (preg_match("/views/", $file->getPathname())) {
+ if (preg_match("/views/", strtr($file->getPathname(), DIRECTORY_SEPARATOR, '/'))) {
// The preamble for views is a single line that prevents direct script access
$lines = file($file->getPathname());
$this->assert_equal(
@@ -74,7 +75,7 @@ class File_Structure_Test extends Unit_Test_Case {
"in file: {$file->getPathname()}");
} else if (preg_match("|\.php$|", $file->getPathname())) {
$actual = $this->_get_preamble($file->getPathname());
- if ($file->getPathName() == DOCROOT . "index.php") {
+ if (strtr($file->getPathName(), DIRECTORY_SEPARATOR, '/') == DOCROOT . "index.php") {
// index.php allows direct access, so modify our expectations for the first line
$index_expected = $expected;
$index_expected[0] = "<?php";
@@ -118,6 +119,7 @@ class GalleryCodeFilterIterator extends FilterIterator {
public function accept() {
// Skip anything that we didn't write
$path_name = $this->getInnerIterator()->getPathName();
+ $path_name = strtr($path_name, DIRECTORY_SEPARATOR, '/');
return !(strpos($path_name, ".svn") ||
substr($path_name, -1, 1) == "~" ||
strpos($path_name, SYSPATH) !== false ||