diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-19 07:26:25 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-19 07:26:25 +0000 |
commit | fc8cf562f5d7d4f0514512703f017f2979a6dea6 (patch) | |
tree | f447eedc4245b5e00252e0bef0eec2e53dcd22c9 | |
parent | 5e94456ce99aef158d8c35b738bb7fb7d29c6e5b (diff) |
Fix up various little things to get File_Structure_Test to pass.
-rw-r--r-- | core/controllers/welcome.php | 3 | ||||
-rw-r--r-- | core/tests/File_Structure_Test.php | 8 | ||||
-rw-r--r-- | installer/database_config.php | 4 | ||||
-rw-r--r-- | installer/index.php | 5 | ||||
-rw-r--r-- | installer/init_var.php | 3 | ||||
-rw-r--r-- | installer/install.sql | 6 |
6 files changed, 15 insertions, 14 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index ab23fe99..e009452f 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -531,7 +531,8 @@ class Welcome_Controller extends Template_Controller { } $fd = fopen($var_file, "w"); - fwrite($fd, "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");\n"); + fwrite($fd, "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>\n"); + fwrite($fd, "<?php\n"); foreach($objects as $name => $file){ if ($file->getBasename() == "database.php") { continue; diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php index 2c6bd239..e648192a 100644 --- a/core/tests/File_Structure_Test.php +++ b/core/tests/File_Structure_Test.php @@ -60,7 +60,9 @@ 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/", $file->getPathname()) || + $file->getPathName() == DOCROOT . "installer/database_config.php" || + $file->getPathName() == DOCROOT . "installer/init_var.php") { // The preamble for views is a single line that prevents direct script access $lines = file($file->getPathname()); $this->assert_equal( @@ -70,8 +72,8 @@ class File_Structure_Test extends Unit_Test_Case { } else if (preg_match("|\.php$|", $file->getPathname())) { $actual = $this->_get_preamble($file->getPathname()); if ($file->getPathName() == DOCROOT . "index.php" || - $file->getPathName() == DOCROOT . "installer/install.php") { - // index.php and installer.php allow direct access, so modify our expectations for them + $file->getPathName() == DOCROOT . "installer/index.php") { + // index.php and installer/index.php allow direct access; modify our expectations for them $index_expected = $expected; $index_expected[0] = "<?php"; $this->assert_equal($index_expected, $actual, "in file: {$file->getPathname()}"); diff --git a/installer/database_config.php b/installer/database_config.php index 78492eba..3cc452ed 100644 --- a/installer/database_config.php +++ b/installer/database_config.php @@ -1,5 +1,5 @@ -<?php defined('SYSPATH') OR die('No direct access allowed.'); ?> -<?= "<?php" ?> defined('SYSPATH') OR die('No direct access allowed.'); +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?= "<?php" ?> defined("SYSPATH") or die("No direct script access."); /** * @package Database diff --git a/installer/index.php b/installer/index.php index 0d77188d..e76a1f98 100644 --- a/installer/index.php +++ b/installer/index.php @@ -28,10 +28,7 @@ */ define("DOCROOT", dirname(dirname(__FILE__)) . "/"); define("VARPATH", DOCROOT . "var/"); - -// Define this to get the preamable to pass -// @todo: change all preambles to key off of VARPATH instead -define("SYSPATH", "anything"); +define("SYSPATH", "DEFINED_TO_SOMETHING_SO_THAT_WE_CAN_KEEP_CONSISTENT_PREAMBLES_IN_THE_INSTALLER"); require(DOCROOT . "installer/installer.php"); installer::command_line(); diff --git a/installer/init_var.php b/installer/init_var.php index 471de7e7..7c5509f5 100644 --- a/installer/init_var.php +++ b/installer/init_var.php @@ -1,4 +1,5 @@ -<?php defined("SYSPATH") or die("No direct script access."); +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?php mkdir("var/albums"); mkdir("var/resizes"); mkdir("var/thumbs"); diff --git a/installer/install.sql b/installer/install.sql index adae0465..69ce70bb 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -143,7 +143,7 @@ CREATE TABLE `items` ( KEY `type` (`type`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO `items` VALUES (NULL,1232344901,'Welcome to your Gallery3',NULL,1,1,1,NULL,NULL,2,0,NULL,NULL,1,2,NULL,NULL,1,'Gallery','album',1232344901,0,NULL,1,1); +INSERT INTO `items` VALUES (NULL,1232345987,'Welcome to your Gallery3',NULL,1,1,1,NULL,NULL,2,0,NULL,NULL,1,2,NULL,NULL,1,'Gallery','album',1232345987,0,NULL,1,1); DROP TABLE IF EXISTS `items_tags`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; @@ -288,7 +288,7 @@ CREATE TABLE `users` ( UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO `users` VALUES (1,'guest','Guest User','V_i04ead11e8b0559700d2d9b0a7e4e507d2',0,0,NULL,0,1,NULL),(2,'admin','Gallery Administrator','',0,0,NULL,1,0,NULL); +INSERT INTO `users` VALUES (1,'guest','Guest User','iEkC795166ec7ac8c7acced8d31a8421906b',0,0,NULL,0,1,NULL),(2,'admin','Gallery Administrator','',0,0,NULL,1,0,NULL); DROP TABLE IF EXISTS `vars`; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; @@ -301,4 +301,4 @@ CREATE TABLE `vars` ( UNIQUE KEY `module_name` (`module_name`,`name`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO `vars` VALUES (1,'core','active_site_theme','default'),(2,'core','active_admin_theme','admin_default'),(3,'core','page_size','9'),(4,'core','thumb_size','200'),(5,'core','resize_size','640'),(6,'core','graphics_toolkit','imagemagick'),(7,'core','graphics_toolkit_path','/usr/bin'),(8,'core','blocks_dashboard_sidebar','a:4:{i:666455058;a:2:{i:0;s:4:\"core\";i:1;s:11:\"block_adder\";}i:662067510;a:2:{i:0;s:4:\"core\";i:1;s:5:\"stats\";}i:1187917317;a:2:{i:0;s:4:\"core\";i:1;s:13:\"platform_info\";}i:1162793167;a:2:{i:0;s:4:\"core\";i:1;s:12:\"project_news\";}}'),(9,'core','blocks_dashboard_center','a:4:{i:1599027539;a:2:{i:0;s:4:\"core\";i:1;s:7:\"welcome\";}i:2012846555;a:2:{i:0;s:4:\"core\";i:1;s:12:\"photo_stream\";}i:569442894;a:2:{i:0;s:4:\"core\";i:1;s:11:\"log_entries\";}i:1370023749;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(10,'core','version','3.0'),(11,'comment','spam_caught','0'); +INSERT INTO `vars` VALUES (1,'core','active_site_theme','default'),(2,'core','active_admin_theme','admin_default'),(3,'core','page_size','9'),(4,'core','thumb_size','200'),(5,'core','resize_size','640'),(6,'core','graphics_toolkit','imagemagick'),(7,'core','graphics_toolkit_path','/usr/bin'),(8,'core','blocks_dashboard_sidebar','a:4:{i:949042169;a:2:{i:0;s:4:\"core\";i:1;s:11:\"block_adder\";}i:1377548023;a:2:{i:0;s:4:\"core\";i:1;s:5:\"stats\";}i:1576910954;a:2:{i:0;s:4:\"core\";i:1;s:13:\"platform_info\";}i:201768872;a:2:{i:0;s:4:\"core\";i:1;s:12:\"project_news\";}}'),(9,'core','blocks_dashboard_center','a:4:{i:754436234;a:2:{i:0;s:4:\"core\";i:1;s:7:\"welcome\";}i:1128952603;a:2:{i:0;s:4:\"core\";i:1;s:12:\"photo_stream\";}i:1021381592;a:2:{i:0;s:4:\"core\";i:1;s:11:\"log_entries\";}i:1986335277;a:2:{i:0;s:7:\"comment\";i:1;s:15:\"recent_comments\";}}'),(10,'core','version','3.0'),(11,'comment','spam_caught','0'); |