From f64824b35c1c6e42ffd3106a7ce2a3c430f1e589 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 28 May 2009 11:40:44 +0800 Subject: Remove extra line from a bad merge Signed-off-by: Bharat Mediratta --- .gitignore | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitignore b/.gitignore index 702fa990..a20370a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,5 @@ # Ignore the var subdirectory var -index.local.php - - # Ignore the index.local.php index.local.php -- cgit v1.2.3 From 993eecfee61e502660f490bec5b394640b917bd1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 28 May 2009 12:05:35 +0800 Subject: Rename index.local.php to local.php so that tab completion on i works. Makes running tests easier. Signed-off-by: Bharat Mediratta --- .gitignore | 2 +- index.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a20370a7..6ebdd994 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ var # Ignore the index.local.php -index.local.php +local.php diff --git a/index.php b/index.php index d8fc2742..b92f7353 100644 --- a/index.php +++ b/index.php @@ -59,8 +59,8 @@ if (PHP_SAPI == 'cli') { } define('TMPPATH', VARPATH . '/tmp'); -if (file_exists("index.local.php")) { - include("index.local.php"); +if (file_exists("local.php")) { + include("local.php"); } // Initialize. -- cgit v1.2.3 From 3b3531cbb834c192339292df8ab3e9220a48d924 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 30 May 2009 15:34:03 -0700 Subject: Add a / to the end of TMPPATH to match other paths. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index b92f7353..a70053a8 100644 --- a/index.php +++ b/index.php @@ -57,7 +57,7 @@ if (PHP_SAPI == 'cli') { define('TEST_MODE', 0); define('VARPATH', strtr(realpath('var') . '/', DIRECTORY_SEPARATOR, '/')); } -define('TMPPATH', VARPATH . '/tmp'); +define('TMPPATH', VARPATH . '/tmp/'); if (file_exists("local.php")) { include("local.php"); -- cgit v1.2.3 From a5670d8d708c35589a695640694199c7b026877b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 30 May 2009 17:14:17 -0700 Subject: gate $can_edit and $can_add on whether or not we have an $item at all (fixes a bug where search doesn't render because it has no item). --- modules/gallery/helpers/gallery_menu.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php index 0f0e676d..09c2d91a 100644 --- a/modules/gallery/helpers/gallery_menu.php +++ b/modules/gallery/helpers/gallery_menu.php @@ -28,8 +28,8 @@ class gallery_menu_Core { $item = $theme->item(); - $can_edit = access::can("edit", $item) || $is_admin; - $can_add = access::can("add", $item) || $is_admin; + $can_edit = $item && access::can("edit", $item) || $is_admin; + $can_add = $item && (access::can("add", $item) || $is_admin); if ($item && $can_edit || $can_add) { $menu->append($options_menu = Menu::factory("submenu") -- cgit v1.2.3 From 18483908976d9dbfa6f0877f380a9ff9ae83ff8c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 00:10:12 -0700 Subject: Convert single quotes to double quotes --- application/config/config.php | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index d6da2ad1..6a30d91c 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -23,34 +23,34 @@ * then a full URL will be used, eg: http://localhost/kohana/. If it only includes * the path, and a site_protocol is specified, the domain will be auto-detected. */ -$config['site_domain'] = dirname($_SERVER['SCRIPT_NAME']); +$config["site_domain"] = dirname($_SERVER["SCRIPT_NAME"]); /** * Force a default protocol to be used by the site. If no site_protocol is * specified, then the current protocol is used, or when possible, only an * absolute path (with no protocol/domain) is used. */ -$config['site_protocol'] = ''; +$config["site_protocol"] = ""; /** * Name of the front controller for this application. Default: index.php * * This can be removed by using URL rewriting. */ -$config['index_page'] = 'index.php'; +$config["index_page"] = "index.php"; /** * Fake file extension that will be added to all generated URLs. Example: .html */ -$config['url_suffix'] = ''; +$config["url_suffix"] = ""; /** * Length of time of the internal cache in seconds. 0 or FALSE means no caching. * The internal cache stores file paths and config entries across requests and * can give significant speed improvements at the expense of delayed updating. */ -$config['internal_cache'] = FALSE; -$config['internal_cache_path'] = VARPATH . "tmp/"; +$config["internal_cache"] = FALSE; +$config["internal_cache_path"] = VARPATH . "tmp/"; /** * Enable or disable gzip output compression. This can dramatically decrease @@ -59,20 +59,20 @@ $config['internal_cache_path'] = VARPATH . "tmp/"; * * Do not enable this option if you are using output compression in php.ini! */ -$config['output_compression'] = FALSE; +$config["output_compression"] = FALSE; /** * Enable or disable global XSS filtering of GET, POST, and SERVER data. This * option also accepts a string to specify a specific XSS filtering tool. */ -$config['global_xss_filtering'] = TRUE; +$config["global_xss_filtering"] = TRUE; /** * Enable or disable hooks. Setting this option to TRUE will enable * all hooks. By using an array of hook filenames, you can control * which hooks are enabled. Setting this option to FALSE disables hooks. */ -$config['enable_hooks'] = TRUE; +$config["enable_hooks"] = TRUE; /** * Log thresholds: @@ -82,21 +82,21 @@ $config['enable_hooks'] = TRUE; * 3 - Notices * 4 - Debugging */ -$config['log_threshold'] = 3; +$config["log_threshold"] = 3; /** * Message logging directory. */ -$config['log_directory'] = VARPATH . "logs"; -if (@!is_writable($config['log_directory'])) { - $config['log_threshold'] = 0; +$config["log_directory"] = VARPATH . "logs"; +if (@!is_writable($config["log_directory"])) { + $config["log_threshold"] = 0; } /** * Enable or disable displaying of Kohana error pages. This will not affect * logging. Turning this off will disable ALL error pages. */ -$config['display_errors'] = TRUE; +$config["display_errors"] = TRUE; /** * Enable or disable statistics in the final output. Stats are replaced via @@ -104,33 +104,33 @@ $config['display_errors'] = TRUE; * * @see http://docs.kohanaphp.com/general/configuration */ -$config['render_stats'] = TRUE; +$config["render_stats"] = TRUE; /** * Filename prefixed used to determine extensions. For example, an * extension to the Controller class would be named MY_Controller.php. */ -$config['extension_prefix'] = 'MY_'; +$config["extension_prefix"] = "MY_"; /** * Additional resource paths, or "modules". Each path can either be absolute * or relative to the docroot. Modules can include any resource that can exist * in your application directory, configuration files, controllers, views, etc. */ -$config['modules'] = array( - MODPATH . 'forge', - MODPATH . 'gallery', // gallery must be *last* in the order +$config["modules"] = array( + MODPATH . "forge", + MODPATH . "gallery", // gallery must be *last* in the order ); if (TEST_MODE) { - array_splice($config['modules'], 0, 0, - array(MODPATH . 'gallery_unit_test', - MODPATH . 'unit_test')); + array_splice($config["modules"], 0, 0, + array(MODPATH . "gallery_unit_test", + MODPATH . "unit_test")); } /** * Setting the maintenance_mode to block all non administrative access. In * this mode a user can attempt to logon, but will be unable to access anything. - * The application will be have normally if an adminstrator logs on. + * The application will behave normally if an adminstrator logs on. */ //$config["maintenance_mode"] = true; -- cgit v1.2.3 From ad81861c331f60ec8c19ea11e47e2826660fa142 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 00:11:02 -0700 Subject: First pass at an XSS security test, along with the "p" helper which can clean HTML output. --- modules/gallery/helpers/p.php | 33 +++++++ modules/gallery/tests/Xss_Security_Test.php | 138 ++++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 modules/gallery/helpers/p.php create mode 100644 modules/gallery/tests/Xss_Security_Test.php diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php new file mode 100644 index 00000000..69032840 --- /dev/null +++ b/modules/gallery/helpers/p.php @@ -0,0 +1,33 @@ +purify($dirty_html)); + } + + function clean($dirty_html) { + // return $dirty_html; + return htmlentities($dirty_html, ENT_QUOTES); + // return Purify::instance()->purify($dirty_html); + } +} diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php new file mode 100644 index 00000000..22c4a767 --- /dev/null +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -0,0 +1,138 @@ + array(), "t2" => array()); + $token_number = 0; + // Filter out HTML / whitespace, and build a lookup for global function calls. + foreach ($raw_tokens as $token) { + if ((!is_array($token)) || (($token[0] != T_WHITESPACE) && ($token[0] != T_INLINE_HTML))) { + if (is_array($token)) { + if ($token[0] == T_STRING && in_array($token[1], array("t", "t2"))) { + $func_token_list[$token[1]][] = $token_number; + } + } + $tokens[] = $token; + $token_number++; + } + } + unset($raw_tokens); + + if (!empty($func_token_list["t"])) { + l10n_scanner::_parse_t_calls($tokens, $func_token_list["t"], $cache); + } + if (!empty($func_token_list["t2"])) { + l10n_scanner::_parse_plural_calls($tokens, $func_token_list["t2"], $cache); + } + } + + public function find_unescaped_variables_in_views_test() { + // foreach (glob("*/*/views/*.php") as $view) { + foreach (array("modules/search/views/search.html.php") as $view) { + $expr = null; + $line = null; + $level = 0; + $php = 0; + $str = null; + $in_p_clean = 0; + foreach (token_get_all(file_get_contents($view)) as $token) { + if (false /* useful for debugging */) { + if (is_array($token)) { + printf("[$str] [$in_p_clean] %-15s %s\n", token_name($token[0]), $token[1]); + } else { + printf("[$str] [$in_p_clean] %-15s %s\n", "", $token); + } + } + + // If we find a "(" after a "p::clean" then start counting levels of parens and assume + // that we're inside a p::clean() call until we find the matching close paren. + if ($token[0] == "(" && $str == "p::clean") { + $in_p_clean = 1; + } else if ($token[0] == "(" && $in_p_clean) { + $in_p_clean++; + } else if ($token[0] == ")" && $in_p_clean) { + $in_p_clean--; + } + + // Concatenate runs of strings for convenience, which we use above to figure out if we're + // inside a p::clean() call or not + if ($token[0] == T_STRING || $token[0] == T_DOUBLE_COLON) { + $str .= $token[1]; + } else { + $str = null; + } + + // Scan for any occurrences of < ? = $variable ? > and store it in $expr + if ($token[0] == T_OPEN_TAG_WITH_ECHO) { + $php++; + } else if ($php && $token[0] == T_CLOSE_TAG) { + $php--; + } else if ($php && $token[0] == T_VARIABLE) { + if (!$expr) { + $entry = array($token[2], $in_p_clean); + } + $expr .= $token[1]; + } else if ($expr) { + if ($token[0] == T_OBJECT_OPERATOR) { + $expr .= $token[1]; + } else if ($token[0] == T_STRING) { + $expr .= $token[1]; + } else if ($token == "(") { + $expr .= $token; + $level++; + } else if ($level > 0 && $token == ")") { + $expr .= $token; + $level--; + } else if ($level > 0) { + $expr .= is_array($token) ? $token[1] : $token; + } else { + $entry[] = $expr; + $found[$view][] = $entry; + $expr = null; + $entry = null; + } + } + } + } + + $canonical = MODPATH . "gallery/tests/xss_data.txt"; + $new = TMPPATH . "xss_data.txt"; + $fd = fopen($new, "wb"); + ksort($found); + foreach ($found as $view => $entries) { + foreach ($entries as $entry) { + fwrite($fd, + sprintf("%-60s %-3s %-9s %s\n", + $view, $entry[0], $entry[1] ? "CLEAN" : "NOT_CLEAN", $entry[2])); + } + } + fclose($fd); + + exec("diff $canonical $new", $output, $return_value); + $this->assert_false( + $return_value, "XSS golden file mismatch. Output:\n" . implode("\n", $output) ); + } +} -- cgit v1.2.3 From 708f27f483d70660446ea2132b02cb7b39225f98 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 00:11:48 -0700 Subject: Run p::clean() on any variables that contain data entered by users. --- .../comment/views/admin_block_recent_comments.html.php | 6 +++--- modules/comment/views/admin_comments.html.php | 10 +++++----- modules/comment/views/comment.html.php | 6 +++--- modules/comment/views/comments.html.php | 6 +++--- modules/exif/views/exif_dialog.html.php | 4 ++-- modules/gallery/views/admin_advanced_settings.html.php | 8 ++++---- modules/gallery/views/admin_block_log_entries.html.php | 2 +- .../gallery/views/admin_block_photo_stream.html.php | 4 ++-- modules/gallery/views/admin_maintenance.html.php | 2 +- modules/gallery/views/after_install.html.php | 2 +- modules/gallery/views/move_tree.html.php | 8 ++++---- modules/gallery/views/permissions_browse.html.php | 4 ++-- modules/gallery/views/permissions_form.html.php | 2 +- modules/gallery/views/simple_uploader.html.php | 6 +++--- modules/info/views/info_block.html.php | 8 ++++---- modules/notification/views/comment_published.html.php | 18 +++++++++++------- modules/notification/views/item_added.html.php | 14 +++++++++----- modules/search/views/search.html.php | 10 ++++++---- 18 files changed, 65 insertions(+), 55 deletions(-) diff --git a/modules/comment/views/admin_block_recent_comments.html.php b/modules/comment/views/admin_block_recent_comments.html.php index d7b8d2b0..d5aab84c 100644 --- a/modules/comment/views/admin_block_recent_comments.html.php +++ b/modules/comment/views/admin_block_recent_comments.html.php @@ -4,13 +4,13 @@
  • "> " class="gAvatar" - alt="author_name() ?>" + alt="author_name()) ?>" width="32" height="32" /> created) ?> %author_name said %comment_text", - array("author_name" => $comment->author_name(), - "comment_text" => text::limit_words($comment->text, 50))); ?> + array("author_name" => p::clean($comment->author_name()), + "comment_text" => text::limit_words(p::clean($comment->text), 50))); ?>
  • diff --git a/modules/comment/views/admin_comments.html.php b/modules/comment/views/admin_comments.html.php index 16816636..79bdb1f3 100644 --- a/modules/comment/views/admin_comments.html.php +++ b/modules/comment/views/admin_comments.html.php @@ -108,12 +108,12 @@ " class="gAvatar" - alt="author_name() ?>" + alt="author_name()) ?>" width="40" height="40" /> -

    author_name() ?>

    +

    author_name()) ?>

    created); ?>

    - text ?> + text) ?>
      diff --git a/modules/comment/views/comment.html.php b/modules/comment/views/comment.html.php index 1a674142..0337173b 100644 --- a/modules/comment/views/comment.html.php +++ b/modules/comment/views/comment.html.php @@ -4,14 +4,14 @@ " class="gAvatar" - alt="author_name() ?>" + alt="author_name()) ?>" width="40" height="40" /> created) ?> - author_name() ?> + author_name()) ?>

      - text ?> + text) ?>
      diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index 25928ab5..95f07baf 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -12,16 +12,16 @@ " class="gAvatar" - alt="author_name() ?>" + alt="author_name()) ?>" width="40" height="40" /> %name said", array("date" => date("Y-M-d H:i:s", $comment->created), - "name" => $comment->author_name())); ?> + "name" => p::clean($comment->author_name()))); ?>

      - text ?> + text) ?>
      diff --git a/modules/exif/views/exif_dialog.html.php b/modules/exif/views/exif_dialog.html.php index d7985a30..6494b2b0 100644 --- a/modules/exif/views/exif_dialog.html.php +++ b/modules/exif/views/exif_dialog.html.php @@ -14,14 +14,14 @@ - + - + diff --git a/modules/gallery/views/admin_advanced_settings.html.php b/modules/gallery/views/admin_advanced_settings.html.php index 9f90d671..77aff050 100644 --- a/modules/gallery/views/admin_advanced_settings.html.php +++ b/modules/gallery/views/admin_advanced_settings.html.php @@ -20,12 +20,12 @@ module_name == "gallery" && $var->name == "_cache") continue ?> module_name ?> - name ?> + name) ?> - module_name/$var->name") ?>" + module_name/" . p::clean($var->name)) ?>" class="gDialogLink" - title=" $var->name, "module_name" => $var->module_name)) ?>"> - value ?> + title=" p::clean($var->name), "module_name" => $var->module_name)) ?>"> + value) ?> diff --git a/modules/gallery/views/admin_block_log_entries.html.php b/modules/gallery/views/admin_block_log_entries.html.php index db6313e1..5d8f3084 100644 --- a/modules/gallery/views/admin_block_log_entries.html.php +++ b/modules/gallery/views/admin_block_log_entries.html.php @@ -2,7 +2,7 @@
      • - user_id") ?>">user->name ?> + user_id") ?>">user->name) ?> timestamp) ?> message ?> html ?> diff --git a/modules/gallery/views/admin_block_photo_stream.html.php b/modules/gallery/views/admin_block_photo_stream.html.php index e8a4d933..1e1329d1 100644 --- a/modules/gallery/views/admin_block_photo_stream.html.php +++ b/modules/gallery/views/admin_block_photo_stream.html.php @@ -2,9 +2,9 @@
        • - id") ?>" title="title ?>"> + id") ?>" title="title) ?>"> width, $photo->height, 72) ?> - src="thumb_url() ?>" alt="title ?>" /> + src="thumb_url() ?>" alt="title) ?>" />
        • diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index bc060a7b..66c4eea0 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -90,7 +90,7 @@ status ?> - owner()->name ?> + owner()->name) ?> state == "stalled"): ?> diff --git a/modules/gallery/views/after_install.html.php b/modules/gallery/views/after_install.html.php index aa26858a..d6ba8e7c 100644 --- a/modules/gallery/views/after_install.html.php +++ b/modules/gallery/views/after_install.html.php @@ -8,7 +8,7 @@

          - %user_name account. The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => $user->name)) ?> + %user_name account. The very first thing you should do is to change your password to something that you'll remember.", array("user_name" => p::clean($user->name))) ?>

          diff --git a/modules/gallery/views/move_tree.html.php b/modules/gallery/views/move_tree.html.php index a3a4bc8f..91a2f9da 100644 --- a/modules/gallery/views/move_tree.html.php +++ b/modules/gallery/views/move_tree.html.php @@ -1,18 +1,18 @@ thumb_tag(array(), 25); ?> is_descendant($parent)): ?> - title ?> + title) ?> - title ?> + title) ?>

          • thumb_tag(array(), 25); ?> is_descendant($child)): ?> - title ?> + title) ?> - title ?> + title) ?>
          • diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index 749bee4f..5cd9cf82 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -35,14 +35,14 @@
          • - title ?> + title) ?>
            • - title ?> + title) ?>
              diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index 94103705..adf2bd94 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -6,7 +6,7 @@ - name ?> + name) ?> diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index b6725c31..abda6d26 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -5,7 +5,7 @@
              ">
              - $item->title)) ?> + p::clean($item->title))) ?>
              @@ -25,9 +25,9 @@

                parents() as $parent): ?> -
              • title ?>
              • +
              • title) ?>
              • -
              • title ?>
              • +
              • title) ?>

              diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 880d5d3e..db664894 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -3,18 +3,18 @@ - title; ?> + title) ?> description): ?> - description; ?> + description) ?> id != 1): ?> - name; ?> + name) ?> captured): ?> @@ -26,7 +26,7 @@ owner): ?> - owner->name ?> + owner->name) ?> diff --git a/modules/notification/views/comment_published.html.php b/modules/notification/views/comment_published.html.php index 23588c72..ff2ba0bc 100644 --- a/modules/notification/views/comment_published.html.php +++ b/modules/notification/views/comment_published.html.php @@ -1,30 +1,34 @@ - <?= $subject ?> + <?= p::clean($subject) ?> -

              +

              - + - + - + - + - +
              text ?>text) ?>
              author_name() ?>author_name()) ?>
              author_email() ?>author_email()) ?>
              author_url() ?>author_url()) ?>
              item()->url(array(), true) ?>#comments + + item()->url(array(), true) ?>#comments + +
              diff --git a/modules/notification/views/item_added.html.php b/modules/notification/views/item_added.html.php index b67b9f38..32857c08 100644 --- a/modules/notification/views/item_added.html.php +++ b/modules/notification/views/item_added.html.php @@ -1,23 +1,27 @@ - <?= $subject ?> + <?= p::clean($subject) ?> -

              +

              - + - + description): ?> - +
              title ?>title) ?>
              url(array(), true) ?> + + url(array(), true) ?> + +
              description ?>description) ?>
              diff --git a/modules/search/views/search.html.php b/modules/search/views/search.html.php index fb1fd8a9..de4343ae 100644 --- a/modules/search/views/search.html.php +++ b/modules/search/views/search.html.php @@ -8,7 +8,7 @@
              -- cgit v1.2.3 From a049de28ace48a3970371caf24d7c389d8d93cd7 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 00:13:28 -0700 Subject: Update the clean/dirty format, check all ffiles instead of just one (which was for debugging) --- modules/gallery/tests/Xss_Security_Test.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index 22c4a767..8bee8c42 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -50,8 +50,7 @@ class Xss_Security_Test extends Unit_Test_Case { } public function find_unescaped_variables_in_views_test() { - // foreach (glob("*/*/views/*.php") as $view) { - foreach (array("modules/search/views/search.html.php") as $view) { + foreach (glob("*/*/views/*.php") as $view) { $expr = null; $line = null; $level = 0; @@ -125,8 +124,8 @@ class Xss_Security_Test extends Unit_Test_Case { foreach ($found as $view => $entries) { foreach ($entries as $entry) { fwrite($fd, - sprintf("%-60s %-3s %-9s %s\n", - $view, $entry[0], $entry[1] ? "CLEAN" : "NOT_CLEAN", $entry[2])); + sprintf("%-60s %-3s %-5s %s\n", + $view, $entry[0], $entry[1] ? "CLEAN" : "DIRTY", $entry[2])); } } fclose($fd); -- cgit v1.2.3 From 9369ccab7fb3413d63e218cec81b4cf43442fd98 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 01:02:51 -0700 Subject: Run all variables that come from user-entered data through p::clean() --- modules/notification/views/item_deleted.html.php | 12 +++++++---- modules/notification/views/item_updated.html.php | 12 +++++------ modules/organize/views/organize.html.php | 2 +- modules/organize/views/organize_album.html.php | 2 +- modules/rss/views/comment.mrss.php | 14 ++++++------- modules/rss/views/feed.mrss.php | 14 ++++++------- modules/server_add/views/server_add_tree.html.php | 2 +- .../views/server_add_tree_dialog.html.php | 6 +++--- modules/tag/views/admin_tags.html.php | 2 +- modules/tag/views/tag_cloud.html.php | 2 +- modules/user/views/admin_users.html.php | 8 ++++---- modules/user/views/admin_users_group.html.php | 12 +++++++---- modules/user/views/login.html.php | 2 +- modules/user/views/reset_password.html.php | 23 +++++++++++----------- 14 files changed, 61 insertions(+), 52 deletions(-) diff --git a/modules/notification/views/item_deleted.html.php b/modules/notification/views/item_deleted.html.php index ac9ab594..2d6d5738 100644 --- a/modules/notification/views/item_deleted.html.php +++ b/modules/notification/views/item_deleted.html.php @@ -1,20 +1,24 @@ - <?= $subject ?> + <?= p::clean($subject) ?> -

              +

              - +
              $item->parent()->title)) ?> + array("title" => p::clean($item->parent()->title))) ?>
              parent()->url(array(), true) ?> + + parent()->url(array(), true) ?> + +
              diff --git a/modules/notification/views/item_updated.html.php b/modules/notification/views/item_updated.html.php index cba522e8..0620c50c 100644 --- a/modules/notification/views/item_updated.html.php +++ b/modules/notification/views/item_updated.html.php @@ -1,18 +1,18 @@ - <?= $subject ?> + <?= p::clean($subject) ?> -

              +

              title != $new->title): ?> - + - + @@ -22,12 +22,12 @@ description != $new->description): ?> - + description)): ?> - +
              title ?>title) ?> title ?>title) ?>
              description ?>description) ?>
              description ?>description) ?>
              diff --git a/modules/organize/views/organize.html.php b/modules/organize/views/organize.html.php index 2f2c3a62..6e5bfcea 100644 --- a/modules/organize/views/organize.html.php +++ b/modules/organize/views/organize.html.php @@ -16,7 +16,7 @@ var CONFIRM_DELETE = "
              - $item->title)) ?> + p::clean($item->title))) ?>
              diff --git a/modules/organize/views/organize_album.html.php b/modules/organize/views/organize_album.html.php index 9c4d042a..ae2d5d51 100644 --- a/modules/organize/views/organize_album.html.php +++ b/modules/organize/views/organize_album.html.php @@ -7,7 +7,7 @@
              gBranchText"> - title ?> + title) ?>
              "> diff --git a/modules/rss/views/comment.mrss.php b/modules/rss/views/comment.mrss.php index 8b7e4f70..d2177026 100644 --- a/modules/rss/views/comment.mrss.php +++ b/modules/rss/views/comment.mrss.php @@ -6,9 +6,9 @@ xmlns:fh="http://purl.org/syndication/history/1.0"> gallery3 - <?= $title ?> + <?= p::clean($title) ?> - + en-us @@ -22,17 +22,17 @@ - <?= $child["title"]?> - - + <?= p::clean($child["title"]) ?> + +

              +

              " - height="" width="" /> + height="" width="" />

              ]]> diff --git a/modules/rss/views/feed.mrss.php b/modules/rss/views/feed.mrss.php index c581e5e0..0beebbcf 100644 --- a/modules/rss/views/feed.mrss.php +++ b/modules/rss/views/feed.mrss.php @@ -6,9 +6,9 @@ xmlns:fh="http://purl.org/syndication/history/1.0"> gallery3 - <?= htmlspecialchars($title) ?> + <?= p::clean($title) ?> - + en-us @@ -22,25 +22,25 @@ - <?= htmlspecialchars($child->title) ?> + <?= p::clean($child->title) ?> type}s/{$child->id}") ?> type}s/{$child->id}") ?> created); ?> description ?> + description) ?>

              type == "photo" || $child->type == "album"): ?>
              type}s/{$child->id}") ?>">
              - description ?> + description) ?>

              ]]>
              diff --git a/modules/server_add/views/server_add_tree.html.php b/modules/server_add/views/server_add_tree.html.php index 69ff09a6..b7b494e4 100644 --- a/modules/server_add/views/server_add_tree.html.php +++ b/modules/server_add/views/server_add_tree.html.php @@ -16,7 +16,7 @@ $("#").ready(function() { - +
            diff --git a/modules/server_add/views/server_add_tree_dialog.html.php b/modules/server_add/views/server_add_tree_dialog.html.php index c8eb6a1c..f600ce60 100644 --- a/modules/server_add/views/server_add_tree_dialog.html.php +++ b/modules/server_add/views/server_add_tree_dialog.html.php @@ -5,14 +5,14 @@
            -

            +

            p::clean($album_title))) ?>

              -
            • title ?>
            • +
            • title) ?>
            • -
            • +
            "post")) ?> diff --git a/modules/tag/views/admin_tags.html.php b/modules/tag/views/admin_tags.html.php index 133b452f..62e3a2a1 100644 --- a/modules/tag/views/admin_tags.html.php +++ b/modules/tag/views/admin_tags.html.php @@ -48,7 +48,7 @@
          • - name ?> + name) ?> (count ?>) id") ?>" class="gDialogLink delete-link gButtonLink"> diff --git a/modules/tag/views/tag_cloud.html.php b/modules/tag/views/tag_cloud.html.php index 9deedb20..eba615fc 100644 --- a/modules/tag/views/tag_cloud.html.php +++ b/modules/tag/views/tag_cloud.html.php @@ -3,7 +3,7 @@
          • count ?> photos are tagged with - id") ?>">name ?> + id") ?>">name) ?>
          diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index bec74d28..859f3c8e 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -68,16 +68,16 @@ " title="" - alt="name ?>" + alt="name) ?>" width="20" height="20" /> - name ?> + name) ?> - full_name ?> + full_name) ?> - email ?> + email) ?> last_login == 0) ? "" : date("j-M-y", $user->last_login) ?> diff --git a/modules/user/views/admin_users_group.html.php b/modules/user/views/admin_users_group.html.php index a25e687a..820b3031 100644 --- a/modules/user/views/admin_users_group.html.php +++ b/modules/user/views/admin_users_group.html.php @@ -1,8 +1,8 @@ -name ?> +name) ?> special): ?> id") ?>" - title="name) ?>" + title=" p::clean($group->name))) ?>" class="gDialogLink gButtonLink ui-state-default ui-corner-all"> @@ -13,11 +13,15 @@
            users as $i => $user): ?>
          • - name ?> + name) ?> special): ?> - Remove name ?> from name ?> + + p::clean($user->name), "group" => p::clean($group->name))) ?> + +
          • diff --git a/modules/user/views/login.html.php b/modules/user/views/login.html.php index d9a558b5..cce2fb54 100644 --- a/modules/user/views/login.html.php +++ b/modules/user/views/login.html.php @@ -11,7 +11,7 @@ 'id}") . '" title="' . t("Edit Your Profile") . '" id="gUserProfileLink" class="gDialogLink">' . - (empty($user->full_name) ? $user->name : $user->full_name) . '')) ?> + p::clean(empty($user->full_name) ? $user->name : $user->full_name) . '')) ?>
          • diff --git a/modules/user/views/reset_password.html.php b/modules/user/views/reset_password.html.php index 39845d61..4c4672ee 100644 --- a/modules/user/views/reset_password.html.php +++ b/modules/user/views/reset_password.html.php @@ -1,14 +1,15 @@ - - <?= $title ?> - - -

            -

            - -
            - -

            - + + <?= t("Password Reset Request") ?> + + +

            +

            + p::clean($user->full_name ? $user->full_name : $user->name))) ?> +

            +

            + %site_url. If you made this request, you can confirm it by clicking this link. If you didn't request this password reset, it's ok to ignore this mail.", array("site_url" => url::base(false, "http"), "confirm_url" => $confirm_url)) ?> +

            + -- cgit v1.2.3 From 712fdb55458f5d89fb5e5e4f4f99b8e1c130ba60 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 01:03:24 -0700 Subject: Clean up view variables --- modules/user/controllers/password.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/user/controllers/password.php b/modules/user/controllers/password.php index 8604b7c4..c3e66634 100644 --- a/modules/user/controllers/password.php +++ b/modules/user/controllers/password.php @@ -57,9 +57,8 @@ class Password_Controller extends Controller { $user->hash = md5(rand()); $user->save(); $message = new View("reset_password.html"); - $message->url = url::abs_site("password/do_reset?key=$user->hash"); - $message->name = $user->full_name; - $message->title = t("Password Reset Request"); + $message->confirm_url = url::abs_site("password/do_reset?key=$user->hash"); + $message->user = $user; Sendmail::factory() ->to($user->email) -- cgit v1.2.3 From 2e16c9557c8a1641b3dd5826492f826a1a96bfb0 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 01:06:51 -0700 Subject: Run all variables containing user-entered text through p::clean() --- themes/default/views/album.html.php | 6 +++--- themes/default/views/dynamic.html.php | 4 ++-- themes/default/views/header.html.php | 8 ++++++-- themes/default/views/movie.html.php | 4 ++-- themes/default/views/page.html.php | 2 +- themes/default/views/photo.html.php | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/themes/default/views/album.html.php b/themes/default/views/album.html.php index f4baa210..6e17696d 100644 --- a/themes/default/views/album.html.php +++ b/themes/default/views/album.html.php @@ -2,8 +2,8 @@
            album_top() ?> -

            title ?>

            -
            description ?>
            +

            title) ?>

            +
            description) ?>
              @@ -18,7 +18,7 @@ thumb_tag(array("class" => "gThumbnail")) ?> thumb_bottom($child) ?> -

              title ?>

              +

              title) ?>

              diff --git a/themes/default/views/dynamic.html.php b/themes/default/views/dynamic.html.php index 8d2d2123..12b5192c 100644 --- a/themes/default/views/dynamic.html.php +++ b/themes/default/views/dynamic.html.php @@ -3,7 +3,7 @@
              dynamic_top() ?>
              -

              name ?>

              +

              name) ?>

                @@ -16,7 +16,7 @@ width="thumb_width ?>" height="thumb_height ?>" /> -

                title ?>

                +

                title) ?>

                thumb_bottom($child) ?> -- cgit v1.2.3 From 897ca2806d46134aa00167c5d9d9ab34eee65e37 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 01:22:48 -0700 Subject: Updated for renamed variable --- modules/gallery/tests/xss_data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 68bf2302..c79f859a 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -402,7 +402,7 @@ modules/rss/views/feed.mrss.php 72 DIRTY $child->h modules/rss/views/feed.mrss.php 73 DIRTY $child->width modules/rss/views/feed.mrss.php 74 DIRTY $child->mime_type modules/rss/views/rss_block.html.php 6 DIRTY $url -modules/rss/views/rss_block.html.php 8 DIRTY $text +modules/rss/views/rss_block.html.php 8 DIRTY $title modules/search/views/search.html.php 11 CLEAN $q modules/search/views/search.html.php 30 DIRTY $item_class modules/search/views/search.html.php 31 DIRTY $item->id -- cgit v1.2.3 From f9a741782da848c707ac0a122c35e86061a0fbb2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 12:33:10 -0700 Subject: Switch to using html::specialchars() for cleaning. --- modules/gallery/helpers/p.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php index 69032840..c3074c23 100644 --- a/modules/gallery/helpers/p.php +++ b/modules/gallery/helpers/p.php @@ -18,16 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class p_Core { - static function attr($dirty_html) { - // return $dirty_html; - return htmlentities($dirty_html, ENT_QUOTES); - // return str_replace('"', '"', $dirty_html); - // return str_replace('"', '"', Purify::instance()->purify($dirty_html)); - } - function clean($dirty_html) { - // return $dirty_html; - return htmlentities($dirty_html, ENT_QUOTES); - // return Purify::instance()->purify($dirty_html); + return html::specialchars($dirty_html); } } -- cgit v1.2.3 From 181c97ef4b29bb3c68a6c9b5d2f8165e8b44ba29 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 12:53:03 -0700 Subject: Relax the regex we use to extract the movie size so that it works with the new version of ffmpeg that I have on my dev box (ffmpeg 0.5-svn17737+3:0.svn20090303-1) --- modules/gallery/helpers/movie.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 15225fe7..3aa40dc9 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -118,8 +118,7 @@ class movie_Core { $cmd = escapeshellcmd($ffmpeg) . " -i " . escapeshellarg($filename) . " 2>&1"; $result = `$cmd`; - if (preg_match("/Stream.*?Video:.*?(\d+)x(\d+).*\ +([0-9\.]+) (fps|tb).*/", - $result, $regs)) { + if (preg_match("/Stream.*?Video:.*?(\d+)x(\d+)/", $result, $regs)) { list ($width, $height) = array($regs[1], $regs[2]); } else { list ($width, $height) = array(0, 0); -- cgit v1.2.3 From 277c96c2f64e4bac4aaf729221564cdca1e12af2 Mon Sep 17 00:00:00 2001 From: jhilden Date: Sun, 31 May 2009 18:25:43 -0400 Subject: user admin facelift * added drag & drop help message for empty groups * fixed overflow issue with more than ~10 members in one group * CSS improvements --- modules/user/views/admin_users.html.php | 2 +- modules/user/views/admin_users_group.html.php | 38 ++++++++++++++++----------- themes/admin_default/css/screen.css | 36 ++++++++++++++++++++++--- 3 files changed, 56 insertions(+), 20 deletions(-) diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php index 859f3c8e..a99c9506 100644 --- a/modules/user/views/admin_users.html.php +++ b/modules/user/views/admin_users.html.php @@ -118,7 +118,7 @@
                -

                Drag & drop users from the User Admin above into this group box to add group members.

                +
                +

                + +

                +
                -- cgit v1.2.3 From 0ec3f1b830a5b183b9901ab19c934596516e4c69 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 19:32:13 -0700 Subject: Update for changes to admin_users_group.html.php --- modules/gallery/tests/xss_data.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index c79f859a..4aaa520d 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -458,15 +458,16 @@ modules/user/views/admin_users.html.php 83 DIRTY $user->la modules/user/views/admin_users.html.php 86 DIRTY $user->id modules/user/views/admin_users.html.php 91 DIRTY $user->id modules/user/views/admin_users.html.php 121 DIRTY $group->id +modules/user/views/admin_users.html.php 121 DIRTY $group->special modules/user/views/admin_users.html.php 123 DIRTY $v -modules/user/views/admin_users_group.html.php 2 CLEAN $group->name -modules/user/views/admin_users_group.html.php 4 DIRTY $group->id -modules/user/views/admin_users_group.html.php 5 CLEAN $group->name -modules/user/views/admin_users_group.html.php 16 CLEAN $user->name -modules/user/views/admin_users_group.html.php 18 DIRTY $user->id -modules/user/views/admin_users_group.html.php 18 DIRTY $group->id -modules/user/views/admin_users_group.html.php 22 CLEAN $user->name -modules/user/views/admin_users_group.html.php 22 CLEAN $group->name +modules/user/views/admin_users_group.html.php 3 CLEAN $group->name +modules/user/views/admin_users_group.html.php 5 DIRTY $group->id +modules/user/views/admin_users_group.html.php 6 CLEAN $group->name +modules/user/views/admin_users_group.html.php 20 CLEAN $user->name +modules/user/views/admin_users_group.html.php 22 DIRTY $user->id +modules/user/views/admin_users_group.html.php 22 DIRTY $group->id +modules/user/views/admin_users_group.html.php 25 CLEAN $user->name +modules/user/views/admin_users_group.html.php 25 CLEAN $group->name modules/user/views/login.html.php 11 DIRTY $user->id modules/user/views/login.html.php 14 CLEAN $user->full_name modules/user/views/login.html.php 14 CLEAN $user->name -- cgit v1.2.3 From 1f7cec2e754ad2eb933cf76cd59a88bf49853f49 Mon Sep 17 00:00:00 2001 From: bharat Date: Mon, 1 Jun 2009 00:21:18 -0400 Subject: Change E_NONE -> 0 .. turns out E_NONE is a figment of my imagination according to http://us.php.net/manual/sl/function.error-reporting.php --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index a70053a8..3acbea74 100644 --- a/index.php +++ b/index.php @@ -27,7 +27,7 @@ version_compare(PHP_VERSION, '5.2.3', '<') and exit('Gallery requires PHP 5.2.3 !ini_get('short_open_tag') and exit('Gallery requires short_open_tag to be on.'); // Set the error reporting level. Use E_ALL unless you have a special need. -error_reporting(E_NONE); +error_reporting(0); // Disabling display_errors will effectively disable Kohana error display // and logging. You can turn off Kohana errors in application/config/config.php -- cgit v1.2.3 From c96b81db6521c8d2b0f3601557011661b0a2d9b8 Mon Sep 17 00:00:00 2001 From: bharat Date: Mon, 1 Jun 2009 00:22:21 -0400 Subject: Fix a warning --- installer/installer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/installer/installer.php b/installer/installer.php index ab2963ba..1a36ddb5 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -50,6 +50,7 @@ class installer { static function unpack_sql($config) { $prefix = $config["prefix"]; + $buf = null; foreach (file(DOCROOT . "installer/install.sql") as $line) { $buf .= $line; if (preg_match("/;$/", $buf)) { @@ -133,4 +134,4 @@ class installer { static function prepend_prefix($prefix, $sql) { return preg_replace("#{([a-zA-Z0-9_]+)}#", "{$prefix}$1", $sql); } -} \ No newline at end of file +} -- cgit v1.2.3 From 8ebd941c81070b1454ff5e4ab97b4f3e14cbf345 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 21:48:43 -0700 Subject: Properly call user::login when we automatically login the admin user immediately after install. Fixes ticket #323. --- modules/user/helpers/user.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 5d70b8c9..9e9d4ca1 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -123,6 +123,7 @@ class user_Core { // upconvert into a user. if ($user === 2) { $user = model_cache::get("user", 2); + user::login($user); $session->set("user", $user); } -- cgit v1.2.3 From 297fb737ac1e8b5a50a3220cb0841457b042ac92 Mon Sep 17 00:00:00 2001 From: bharat Date: Mon, 1 Jun 2009 01:07:05 -0400 Subject: Convert %7E to ~ when proxying files to work around Firefox's overzealous security model. --- modules/gallery/controllers/file_proxy.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 2037ad98..1901bd9f 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -32,9 +32,13 @@ class File_Proxy_Controller extends Controller { $request_uri = $this->input->server("REQUEST_URI"); $request_uri = preg_replace("/\?.*/", "", $request_uri); + // Firefox converts ~ to %7E breaking our url comparison, below. Convert that back here. + $request_uri = str_replace("%7E", "~", $request_uri); + // var_uri: http://example.com/gallery3/var/ $var_uri = url::file("var/"); + // Make sure that the request is for a file inside var $offset = strpos($request_uri, $var_uri); if ($offset === false) { -- cgit v1.2.3 From 54ae9fac88512f1bac05a5952fca9ade2eab0898 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 22:12:14 -0700 Subject: Remove extra blank line --- modules/gallery/controllers/file_proxy.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 1901bd9f..dfdb4f34 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -38,7 +38,6 @@ class File_Proxy_Controller extends Controller { // var_uri: http://example.com/gallery3/var/ $var_uri = url::file("var/"); - // Make sure that the request is for a file inside var $offset = strpos($request_uri, $var_uri); if ($offset === false) { -- cgit v1.2.3 From 33df7de391eebdab2cb09ca97207cb81f4274cd1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 22:25:53 -0700 Subject: Accidentally broke the AllowOverride info url in the migration from core -> modules/gallery. Fixed, and incidentally make the link appear in a new tab/window. --- modules/gallery/views/permissions_browse.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php index 5cd9cf82..8bb2e830 100644 --- a/modules/gallery/views/permissions_browse.html.php +++ b/modules/gallery/views/permissions_browse.html.php @@ -27,7 +27,7 @@
                • - AllowOverride FileInfo Options to fix this.", array("url" => "http://httpd.apache.org/docs/2.0/mod/gallery.html#allowoverride")) ?> + AllowOverride FileInfo Options to fix this.", array("attrs" => "href=\"http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride\" target=\"_blank\"")) ?>
                -- cgit v1.2.3 From 9a7e642cd6cc3d250d9d413c3ce0414e92e9d769 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 22:30:48 -0700 Subject: Don't let relative_path() try to update the database if the Item_Model is not loaded, else you get weird errors. --- modules/gallery/models/item.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 4b8cac8e..9406f5d9 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -287,6 +287,10 @@ class Item_Model extends ORM_MPTT { * @return string */ public function relative_path() { + if (!$this->loaded) { + return; + } + if (!isset($this->relative_path_cache)) { $paths = array(); foreach (Database::instance() -- cgit v1.2.3 From 79a05adb9d941671cefbdf6b1cc97f0cd84fabf3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 31 May 2009 22:33:28 -0700 Subject: Clear the site status message on deactivate, not on uninstall. --- modules/recaptcha/helpers/recaptcha_installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/recaptcha/helpers/recaptcha_installer.php b/modules/recaptcha/helpers/recaptcha_installer.php index 6269c632..f74bf558 100644 --- a/modules/recaptcha/helpers/recaptcha_installer.php +++ b/modules/recaptcha/helpers/recaptcha_installer.php @@ -29,7 +29,7 @@ class recaptcha_installer { recaptcha::check_config(); } - static function uninstall() { + static function deactivate() { site_status::clear("recaptcha_config"); } } -- cgit v1.2.3