From b7074ee59588b74ff4ebb77dd1281941a3c99778 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 5 Jun 2012 20:50:08 -0700 Subject: Clean file paths in Kohana_Exception::debug_path(). Fixes #1880. --- modules/gallery/libraries/MY_Kohana_Exception.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/MY_Kohana_Exception.php b/modules/gallery/libraries/MY_Kohana_Exception.php index dd04b25f..b74c80b1 100644 --- a/modules/gallery/libraries/MY_Kohana_Exception.php +++ b/modules/gallery/libraries/MY_Kohana_Exception.php @@ -94,4 +94,8 @@ class Kohana_Exception extends Kohana_Exception_Core { } return $result; } + + public static function debug_path($file) { + return html::clean(parent::debug_path($file)); + } } \ No newline at end of file -- cgit v1.2.3 From 03d55d25307054547378db123e30c59bebb6944f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 5 Jun 2012 21:25:56 -0700 Subject: Encode urls in 404 log entries. Fixes #1882. --- modules/gallery/libraries/MY_Kohana_Exception.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/MY_Kohana_Exception.php b/modules/gallery/libraries/MY_Kohana_Exception.php index b74c80b1..0c07ea5e 100644 --- a/modules/gallery/libraries/MY_Kohana_Exception.php +++ b/modules/gallery/libraries/MY_Kohana_Exception.php @@ -23,7 +23,7 @@ class Kohana_Exception extends Kohana_Exception_Core { */ public static function text($e) { if ($e instanceof Kohana_404_Exception) { - return "File not found: " . Router::$complete_uri; + return "File not found: " . rawurlencode(Router::$complete_uri); } else { return sprintf( "%s [ %s ]: %s\n%s [ %s ]\n%s", -- cgit v1.2.3 From 37a0e9a710254602ab7f0f3bc29cdfb7ba6f130e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 11 Jun 2012 13:47:00 -0700 Subject: Follow-on to 3caf3cc323cd25b002aa8e44d871d4677da7a029 for #1866 - harden one more place and update the test. --- modules/gallery/libraries/MY_Database.php | 2 +- modules/gallery/tests/Database_Test.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/MY_Database.php b/modules/gallery/libraries/MY_Database.php index fb54bfcd..4fbd62fd 100644 --- a/modules/gallery/libraries/MY_Database.php +++ b/modules/gallery/libraries/MY_Database.php @@ -58,7 +58,7 @@ abstract class Database extends Database_Core { $open_brace = strpos($sql, "{") + 1; $close_brace = strpos($sql, "}", $open_brace); $name = substr($sql, $open_brace, $close_brace - $open_brace); - $this->_table_names["{{$name}}"] = "{$prefix}$name"; + $this->_table_names["{{$name}}"] = "`{$prefix}$name`"; } else if (strpos($sql, "RENAME TABLE") === 0) { // Renaming a table; add it to the table cache. // You must use the form "TO {new_table_name}" exactly for this to work. diff --git a/modules/gallery/tests/Database_Test.php b/modules/gallery/tests/Database_Test.php index 55006abc..fa9e5370 100644 --- a/modules/gallery/tests/Database_Test.php +++ b/modules/gallery/tests/Database_Test.php @@ -106,7 +106,7 @@ class Database_Test extends Gallery_Unit_Test_Case { PRIMARY KEY (`id`), UNIQUE KEY(`name`)) ENGINE=InnoDB DEFAULT CHARSET=utf8"); - $expected = "CREATE TABLE IF NOT EXISTS g_test ( + $expected = "CREATE TABLE IF NOT EXISTS `g_test` ( `id` int(9) NOT NULL auto_increment, `name` varchar(32) NOT NULL, PRIMARY KEY (`id`), @@ -121,9 +121,9 @@ class Database_Test extends Gallery_Unit_Test_Case { " AND `right_ptr` <= 6)"; $sql = $db->add_table_prefixes($sql); - $expected = "UPDATE g_test SET `name` = '{test string}' " . + $expected = "UPDATE `g_test` SET `name` = '{test string}' " . "WHERE `item_id` IN " . - " (SELECT `id` FROM g_test " . + " (SELECT `id` FROM `g_test` " . " WHERE `left_ptr` >= 1 " . " AND `right_ptr` <= 6)"; @@ -133,7 +133,7 @@ class Database_Test extends Gallery_Unit_Test_Case { function prefix_replacement_for_rename_table_test() { $db = Database::instance("mock"); $this->assert_same( - "RENAME TABLE g_test TO g_new_test", + "RENAME TABLE `g_test` TO `g_new_test`", $db->add_table_prefixes("RENAME TABLE {test} TO {new_test}")); } -- cgit v1.2.3