summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/g2_import/helpers/g2_import.php12
-rw-r--r--modules/gallery/tests/File_Structure_Test.php21
2 files changed, 23 insertions, 10 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 60dd593f..51dc8705 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -79,7 +79,8 @@ class g2_import_Core {
array(
"require_once('$base_dir/modules/core/classes/GalleryDataCache.class');",
"require('$base_dir/modules/core/classes/GalleryEmbed.class');"),
- file("$base_dir/embed.php")));
+ array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
+ file("$base_dir/embed.php"))));
file_put_contents(
"$mod_path/main.php",
@@ -90,7 +91,8 @@ class g2_import_Core {
array(
"include(dirname(__FILE__) . '/bootstrap.inc');",
"require_once('$base_dir/init.inc');"),
- file("$base_dir/main.php")));
+ array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
+ file("$base_dir/main.php"))));
file_put_contents(
"$mod_path/bootstrap.inc",
@@ -103,7 +105,8 @@ class g2_import_Core {
"require_once('$base_dir/modules/core/classes/GalleryDataCache.class');",
"define('GALLERY_CONFIG_DIR', '$base_dir');",
"\$gallery =& new G2_Gallery();"),
- file("$base_dir/bootstrap.inc")));
+ array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
+ file("$base_dir/bootstrap.inc"))));
file_put_contents(
"$mod_path/Gallery.class",
@@ -112,7 +115,8 @@ class g2_import_Core {
"function Gallery"),
array("class G2_Gallery",
"function G2_Gallery"),
- file("$base_dir/modules/core/classes/Gallery.class")));
+ array_merge(array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"),
+ file("$base_dir/modules/core/classes/Gallery.class"))));
}
require("$mod_path/embed.php");
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 017b1950..c517bd72 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -91,6 +91,18 @@ class File_Structure_Test extends Unit_Test_Case {
$fp = fopen($path, "r");
$actual = array(fgets($fp));
fclose($fp);
+ } else if (strpos($path, DOCROOT . "var/logs") === 0) {
+ // var/logs has the kohana one-liner preamble
+ $expected = array("<?php defined('SYSPATH') or die('No direct script access.'); ?>\n");
+ $fp = fopen($path, "r");
+ $actual = array(fgets($fp));
+ fclose($fp);
+ } else if (strpos($path, DOCROOT . "var") === 0) {
+ // Anything else under var has the Gallery one-liner
+ $expected = array("<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n");
+ $fp = fopen($path, "r");
+ $actual = array(fgets($fp));
+ fclose($fp);
} else {
// Gallery: we care about the entire copyright
$actual = $this->_get_preamble($path);
@@ -141,14 +153,12 @@ class File_Structure_Test extends Unit_Test_Case {
// Front controllers
break;
- case DOCROOT . "index.local.php":
+ case DOCROOT . "local.php":
// Special case optional file, not part of the codebase
break;
default:
- if (strpos($path, DOCROOT . "var/logs") === 0) {
- continue;
- } else if (preg_match("/views/", $path)) {
+ if (preg_match("/views/", $path)) {
$this->_check_view_preamble($path, $errors);
} else {
$this->_check_php_preamble($path, $errors);
@@ -207,8 +217,7 @@ class File_Structure_Test extends Unit_Test_Case {
class PhpCodeFilterIterator extends FilterIterator {
public function accept() {
$path_name = $this->getInnerIterator()->getPathName();
- return (substr($path_name, -4) == ".php" &&
- !(strpos($path_name, VARPATH) === 0));
+ return substr($path_name, -4) == ".php";
}
}