Date: Mon, 25 Feb 2013 15:09:42 +0100
Subject: Follow-on from autocomplete and gallery.panel.js revisions.
(9345dde83e1f092a9309c45282dc21e3fd408875,
d632ef3e50252d388c272cacd29e8cc6e4949cec,
fd012276cbf03cc1dc7b8da10aac5cc6f26326c6) - revised xss_data.txt golden file
(no new cases). - escaped translated string in admin_users.html.php (would
have otherwise been a new case in xss_data.txt).
---
modules/gallery/tests/xss_data.txt | 12 ++++++------
modules/user/views/admin_users.html.php | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 0028ac87..daba878d 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -42,7 +42,7 @@ modules/comment/views/user_profile_comments.html.php 11 DIRTY $comme
modules/exif/views/exif_dialog.html.php 14 DIRTY $details[$i]["caption"]
modules/exif/views/exif_dialog.html.php 21 DIRTY $details[$i]["caption"]
modules/g2_import/views/admin_g2_import.html.php 7 DIRTY_JS url::site("__ARGS__")
-modules/g2_import/views/admin_g2_import.html.php 52 DIRTY $form
+modules/g2_import/views/admin_g2_import.html.php 49 DIRTY $form
modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY_ATTR text::alternate("g-odd","g-even")
modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY_ATTR log::severity_class($entry->severity)
modules/gallery/views/admin_block_log_entries.html.php 8 DIRTY_JS user_profile::url($entry->user->id)
@@ -216,7 +216,7 @@ modules/gallery/views/menu.html.php 18 DIRTY $eleme
modules/gallery/views/menu_ajax_link.html.php 3 DIRTY $menu->css_id?"id='{$menu->css_id}'":""
modules/gallery/views/menu_ajax_link.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu_ajax_link.html.php 5 DIRTY_JS $menu->url
-modules/gallery/views/menu_ajax_link.html.php 7 DIRTY $menu->ajax_handler
+modules/gallery/views/menu_ajax_link.html.php 7 DIRTY_ATTR $menu->ajax_handler
modules/gallery/views/menu_dialog.html.php 3 DIRTY $menu->css_id?"id='{$menu->css_id}'":""
modules/gallery/views/menu_dialog.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu_dialog.html.php 5 DIRTY_JS $menu->url
@@ -351,8 +351,8 @@ modules/search/views/search.html.php 47 DIRTY_ATTR $ite
modules/search/views/search.html.php 57 DIRTY $theme->paginator()
modules/search/views/search_link.html.php 15 DIRTY_ATTR $album_id
modules/server_add/views/admin_server_add.html.php 8 DIRTY_JS url::site("__ARGS__")
-modules/server_add/views/admin_server_add.html.php 19 DIRTY $form
-modules/server_add/views/admin_server_add.html.php 30 DIRTY_ATTR $id
+modules/server_add/views/admin_server_add.html.php 16 DIRTY $form
+modules/server_add/views/admin_server_add.html.php 27 DIRTY_ATTR $id
modules/server_add/views/server_add_tree.html.php 20 DIRTY_ATTR is_dir($file)?"ui-icon-folder-collapsed":"ui-icon-document"
modules/server_add/views/server_add_tree.html.php 21 DIRTY_ATTR is_dir($file)?"g-directory":"g-file"
modules/server_add/views/server_add_tree_dialog.html.php 3 DIRTY_JS url::site("server_add/children?path=__PATH__")
@@ -360,8 +360,8 @@ modules/server_add/views/server_add_tree_dialog.html.php 4 DIRTY_JS url::s
modules/server_add/views/server_add_tree_dialog.html.php 21 DIRTY $tree
modules/tag/views/admin_tags.html.php 45 DIRTY_ATTR $tag->id
modules/tag/views/admin_tags.html.php 46 DIRTY $tag->count
-modules/tag/views/tag_block.html.php 28 DIRTY $cloud
-modules/tag/views/tag_block.html.php 30 DIRTY $form
+modules/tag/views/tag_block.html.php 26 DIRTY $cloud
+modules/tag/views/tag_block.html.php 28 DIRTY $form
modules/tag/views/tag_cloud.html.php 4 DIRTY_ATTR (int)(($tag->count/$max_count)*7)
modules/tag/views/tag_cloud.html.php 5 DIRTY $tag->count
modules/tag/views/tag_cloud.html.php 6 DIRTY_JS $tag->url()
diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php
index e7abbef9..e4336f7f 100644
--- a/modules/user/views/admin_users.html.php
+++ b/modules/user/views/admin_users.html.php
@@ -92,7 +92,7 @@
id") ?>"
- data-open-text="= t("Close") ?>"
+ data-open-text="= t("Close")->for_html_attr() ?>"
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
= t("Edit") ?>
if (identity::active_user()->id != $user->id && !$user->guest): ?>
--
cgit v1.2.3
From 251e9d5c8f727b886676e010481a6090ddac028c Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Tue, 26 Feb 2013 18:39:59 +0100
Subject: #2010 - Revise item::find_by_path to search for jpg-converted items.
- added extra $var_subdir argument to item::find_by_path. - changed
item::find_by_path to use $var_subdir to detect if we should look for a
jpg-converted item or not (e.g. movie thumbs) - moved the album thumb
detection to item::find_by_path to ensure it knows to look for an exact album
match. - added more sanity checks to item::find_by_path (now has fewer false
positive possibilities).
- updated file_proxy to remove the need to guess different movie files.
- updated File_Proxy_Controller - new sanity checks catch previously undetected bug.
- added additional unit tests for item::find_by_path.
---
modules/gallery/controllers/file_proxy.php | 20 +--
modules/gallery/helpers/item.php | 81 +++++++++--
.../gallery/tests/File_Proxy_Controller_Test.php | 2 +-
modules/gallery/tests/Item_Helper_Test.php | 159 +++++++++++++++++++--
4 files changed, 220 insertions(+), 42 deletions(-)
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 7e5d0038..ac558a71 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -66,24 +66,8 @@ class File_Proxy_Controller extends Controller {
throw $e;
}
- // If the last element is .album.jpg, pop that off since it's not a real item
- $path = preg_replace("|/.album.jpg$|", "", $path);
-
- $item = item::find_by_path($path);
- if (!$item->loaded()) {
- // We didn't turn it up. If we're looking for a .jpg then it's it's possible that we're
- // requesting the thumbnail for a movie. In that case, the movie file would
- // have been converted to a .jpg. So try some alternate types:
- if (preg_match('/.jpg$/', $path)) {
- foreach (legal_file::get_movie_extensions() as $ext) {
- $movie_path = preg_replace('/.jpg$/', ".$ext", $path);
- $item = item::find_by_path($movie_path);
- if ($item->loaded()) {
- break;
- }
- }
- }
- }
+ // Get the item model using the path and type (which corresponds to a var subdir)
+ $item = item::find_by_path($path, $type);
if (!$item->loaded()) {
$e = new Kohana_404_Exception();
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index 9882a9c5..bbbc81d6 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -203,10 +203,18 @@ class item_Core {
/**
* Find an item by its path. If there's no match, return an empty Item_Model.
* NOTE: the caller is responsible for performing security checks on the resulting item.
+ *
+ * In addition to $path, $var_subdir can be specified ("albums", "resizes", or "thumbs"). This
+ * corresponds to the file's directory in var, which is what's used in file_proxy. By specifying
+ * this, we can be smarter about items whose formats get converted (e.g. movies that get jpg
+ * thumbs). If omitted, it defaults to "albums" which looks for identical matches between $path
+ * and the item name, just like pre-v3.1 behavior.
+ *
* @param string $path
+ * @param string $var_subdir
* @return object Item_Model
*/
- static function find_by_path($path) {
+ static function find_by_path($path, $var_subdir="albums") {
$path = trim($path, "/");
// The root path name is NULL not "", hence this workaround.
@@ -214,35 +222,80 @@ class item_Core {
return item::root();
}
+ $search_full_name = true;
+ $album_thumb = false;
+ if (($var_subdir == "thumbs") && preg_match("|^(.*)/\.album\.jpg$|", $path, $matches)) {
+ // It's an album thumb - remove "/.album.jpg" from the path.
+ $path = $matches[1];
+ $album_thumb = true;
+ } else if (($var_subdir != "albums") && preg_match("/^(.*)\.jpg$/", $path, $matches)) {
+ // Item itself could be non-jpg (e.g. movies) - remove .jpg from path, don't search full name.
+ $path = $matches[1];
+ $search_full_name = false;
+ }
+
// Check to see if there's an item in the database with a matching relative_path_cache value.
- // Since that field is urlencoded, we must urlencoded the components of the path.
+ // Since that field is urlencoded, we must urlencode the components of the path.
foreach (explode("/", $path) as $part) {
$encoded_array[] = rawurlencode($part);
}
$encoded_path = join("/", $encoded_array);
- $item = ORM::factory("item")
- ->where("relative_path_cache", "=", $encoded_path)
- ->find();
- if ($item->loaded()) {
- return $item;
+ if ($search_full_name) {
+ $item = ORM::factory("item")
+ ->where("relative_path_cache", "=", $encoded_path)
+ ->find();
+ // See if the item was found and if it should have been found.
+ if ($item->loaded() &&
+ (($var_subdir == "albums") || $item->is_photo() || $album_thumb)) {
+ return $item;
+ }
+ } else {
+ // Note that the below query uses LIKE with wildcard % at end, which is still sargable and
+ // therefore still takes advantage of the indexed relative_path_cache (i.e. still quick).
+ $item = ORM::factory("item")
+ ->where("relative_path_cache", "LIKE", Database::escape_for_like($encoded_path) . ".%")
+ ->find();
+ // See if the item was found and should be a jpg.
+ if ($item->loaded() &&
+ (($item->is_movie() && ($var_subdir == "thumbs")) ||
+ ($item->is_photo() && (preg_match("/^(.*)\.jpg$/", $item->name))))) {
+ return $item;
+ }
}
// Since the relative_path_cache field is a cache, it can be unavailable. If we don't find
// anything, fall back to checking the path the hard way.
$paths = explode("/", $path);
- foreach (ORM::factory("item")
- ->where("name", "=", end($paths))
- ->where("level", "=", count($paths) + 1)
- ->find_all() as $item) {
- if (urldecode($item->relative_path()) == $path) {
- return $item;
+ if ($search_full_name) {
+ foreach (ORM::factory("item")
+ ->where("name", "=", end($paths))
+ ->where("level", "=", count($paths) + 1)
+ ->find_all() as $item) {
+ // See if the item was found and if it should have been found.
+ if ((urldecode($item->relative_path()) == $path) &&
+ (($var_subdir == "albums") || $item->is_photo() || $album_thumb)) {
+ return $item;
+ }
+ }
+ } else {
+ foreach (ORM::factory("item")
+ ->where("name", "LIKE", Database::escape_for_like(end($paths)) . ".%")
+ ->where("level", "=", count($paths) + 1)
+ ->find_all() as $item) {
+ // Compare relative_path without extension (regexp same as legal_file::change_extension),
+ // see if it should be a jpg.
+ if ((preg_replace("/\.[^\.\/]*?$/", "", urldecode($item->relative_path())) == $path) &&
+ (($item->is_movie() && ($var_subdir == "thumbs")) ||
+ ($item->is_photo() && (preg_match("/^(.*)\.jpg$/", $item->name))))) {
+ return $item;
+ }
}
}
+ // Nothing found - return an empty item model.
return new Item_Model();
}
-
/**
* Locate an item using the URL. We assume that the url is in the form /a/b/c where each
* component matches up with an item slug. If there's no match, return an empty Item_Model
diff --git a/modules/gallery/tests/File_Proxy_Controller_Test.php b/modules/gallery/tests/File_Proxy_Controller_Test.php
index 562100e4..06068d62 100644
--- a/modules/gallery/tests/File_Proxy_Controller_Test.php
+++ b/modules/gallery/tests/File_Proxy_Controller_Test.php
@@ -66,7 +66,7 @@ class File_Proxy_Controller_Test extends Gallery_Unit_Test_Case {
public function movie_thumbnails_are_jpgs_test() {
$movie = test::random_movie();
$name = legal_file::change_extension($movie->name, "jpg");
- $_SERVER["REQUEST_URI"] = url::file("var/thumbs/{$movie->name}");
+ $_SERVER["REQUEST_URI"] = url::file("var/thumbs/$name");
$controller = new File_Proxy_Controller();
$this->assert_same($movie->thumb_path(), $controller->__call("", array()));
}
diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php
index f5b99bec..f4995c53 100644
--- a/modules/gallery/tests/Item_Helper_Test.php
+++ b/modules/gallery/tests/Item_Helper_Test.php
@@ -164,11 +164,9 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_same(item::root()->id, item::find_by_path("")->id);
// Verify that we don't get confused by the part names, using the fallback code.
- db::build()
- ->update("items")
- ->set(array("relative_path_cache" => null))
- ->where("id", "IN", array($level3->id, $level3b->id))
- ->execute();
+ self::_remove_relative_path_caches();
+ self::_remove_relative_path_caches();
+
$this->assert_same(
$level3->id,
item::find_by_path("{$level1->name}/{$level2->name}/{$level3->name}")->id);
@@ -180,11 +178,154 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case {
// Verify that we don't get false positives
$this->assert_false(
item::find_by_path("foo/bar/baz")->loaded());
+ }
- // Verify that the fallback code works
- $this->assert_same(
- $level3b->id,
- item::find_by_path("{$level1->name}/{$level2b->name}/{$level3b->name}")->id);
+ public function find_by_path_with_jpg_test() {
+ $parent = test::random_album();
+ $jpg = test::random_photo($parent);
+
+ $jpg_path = "{$parent->name}/{$jpg->name}";
+ $flv_path = legal_file::change_extension($jpg_path, "flv");
+
+ // Check normal operation.
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "albums")->id);
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "resizes")->id);
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "thumbs")->id);
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path)->id);
+
+ // Check that we don't get false positives.
+ $this->assert_equal(null, item::find_by_path($flv_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "resizes")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path)->id);
+
+ // Check normal operation without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "albums")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "resizes")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path, "thumbs")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($jpg->id, item::find_by_path($jpg_path)->id);
+
+ // Check that we don't get false positives without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal(null, item::find_by_path($flv_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "resizes")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path)->id);
+ }
+
+ public function find_by_path_with_png_test() {
+ $parent = test::random_album();
+ $png = test::random_photo_unsaved($parent);
+ $png->set_data_file(MODPATH . "gallery/images/graphicsmagick.png");
+ $png->save();
+
+ $png_path = "{$parent->name}/{$png->name}";
+ $jpg_path = legal_file::change_extension($png_path, "jpg");
+
+ // Check normal operation.
+ $this->assert_equal($png->id, item::find_by_path($png_path, "albums")->id);
+ $this->assert_equal($png->id, item::find_by_path($png_path, "resizes")->id);
+ $this->assert_equal($png->id, item::find_by_path($png_path, "thumbs")->id);
+ $this->assert_equal($png->id, item::find_by_path($png_path)->id);
+
+ // Check that we don't get false positives.
+ $this->assert_equal(null, item::find_by_path($jpg_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path, "resizes")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path)->id);
+
+ // Check normal operation without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal($png->id, item::find_by_path($png_path, "albums")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($png->id, item::find_by_path($png_path, "resizes")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($png->id, item::find_by_path($png_path, "thumbs")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($png->id, item::find_by_path($png_path)->id);
+
+ // Check that we don't get false positives without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal(null, item::find_by_path($jpg_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path, "resizes")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path)->id);
+ }
+
+ public function find_by_path_with_flv_test() {
+ $parent = test::random_album();
+ $flv = test::random_movie($parent);
+
+ $flv_path = "{$parent->name}/{$flv->name}";
+ $jpg_path = legal_file::change_extension($flv_path, "jpg");
+
+ // Check normal operation.
+ $this->assert_equal($flv->id, item::find_by_path($flv_path, "albums")->id);
+ $this->assert_equal($flv->id, item::find_by_path($jpg_path, "thumbs")->id);
+ $this->assert_equal($flv->id, item::find_by_path($flv_path)->id);
+
+ // Check that we don't get false positives.
+ $this->assert_equal(null, item::find_by_path($jpg_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path)->id);
+
+ // Check normal operation without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal($flv->id, item::find_by_path($flv_path, "albums")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($flv->id, item::find_by_path($jpg_path, "thumbs")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($flv->id, item::find_by_path($flv_path)->id);
+
+ // Check that we don't get false positives without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal(null, item::find_by_path($jpg_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($flv_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($jpg_path)->id);
+ }
+
+ public function find_by_path_with_album_test() {
+ $parent = test::random_album();
+ $album = test::random_movie($parent);
+
+ $album_path = "{$parent->name}/{$album->name}";
+ $thumb_path = "{$album_path}/.album.jpg";
+
+ // Check normal operation.
+ $this->assert_equal($album->id, item::find_by_path($album_path, "albums")->id);
+ $this->assert_equal($album->id, item::find_by_path($thumb_path, "thumbs")->id);
+ $this->assert_equal($album->id, item::find_by_path($album_path)->id);
+
+ // Check that we don't get false positives.
+ $this->assert_equal(null, item::find_by_path($thumb_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($album_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($thumb_path)->id);
+
+ // Check normal operation without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal($album->id, item::find_by_path($album_path, "albums")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($album->id, item::find_by_path($thumb_path, "thumbs")->id);
+ self::_remove_relative_path_caches();
+ $this->assert_equal($album->id, item::find_by_path($album_path)->id);
+
+ // Check that we don't get false positives without relative path cache.
+ self::_remove_relative_path_caches();
+ $this->assert_equal(null, item::find_by_path($thumb_path, "albums")->id);
+ $this->assert_equal(null, item::find_by_path($album_path, "thumbs")->id);
+ $this->assert_equal(null, item::find_by_path($thumb_path)->id);
+ }
+
+ private function _remove_relative_path_caches() {
+ // This gets used *many* times in the find_by_path tests above to check the fallback code.
+ db::build()
+ ->update("items")
+ ->set("relative_path_cache", null)
+ ->execute();
}
public function find_by_relative_url_test() {
--
cgit v1.2.3
From 9b9f1a7b07daecf2251770e4f49838f22cb58a2a Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Sat, 2 Mar 2013 13:25:10 +0100
Subject: #2031 - Add class_exists() before method_exists() if class existence
is unknown. - fixed all instances of this in core code - deleted previous
Zend Guard Loader workaround in MY_Kohana.php - updated Bootstrap.php to
reflect deleted MY_Kohana.php
---
application/Bootstrap.php | 2 +-
modules/gallery/controllers/admin.php | 2 +-
modules/gallery/helpers/block_manager.php | 10 +++---
modules/gallery/helpers/module.php | 18 +++++------
modules/gallery/helpers/task.php | 2 +-
modules/gallery/libraries/Admin_View.php | 2 +-
modules/gallery/libraries/IdentityProvider.php | 3 +-
modules/gallery/libraries/MY_Kohana.php | 45 --------------------------
modules/gallery/libraries/SafeString.php | 2 +-
modules/gallery/libraries/Theme_View.php | 4 +--
modules/gallery/tests/Html_Helper_Test.php | 2 +-
modules/gallery/tests/SafeString_Test.php | 4 +--
modules/rest/controllers/rest.php | 2 +-
modules/rest/helpers/rest.php | 6 ++--
modules/rss/controllers/rss.php | 2 +-
modules/rss/helpers/rss_block.php | 2 +-
16 files changed, 32 insertions(+), 76 deletions(-)
delete mode 100644 modules/gallery/libraries/MY_Kohana.php
(limited to 'modules/gallery/tests')
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index a79ccba4..93353b47 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -35,7 +35,7 @@ require SYSPATH.'core/Event'.EXT;
final class Event extends Event_Core {}
require SYSPATH.'core/Kohana'.EXT;
-require MODPATH.'gallery/libraries/MY_Kohana'.EXT;
+final class Kohana extends Kohana_Core {}
require SYSPATH.'core/Kohana_Exception'.EXT;
require MODPATH.'gallery/libraries/MY_Kohana_Exception'.EXT;
diff --git a/modules/gallery/controllers/admin.php b/modules/gallery/controllers/admin.php
index c9d944cc..b35a9299 100644
--- a/modules/gallery/controllers/admin.php
+++ b/modules/gallery/controllers/admin.php
@@ -55,7 +55,7 @@ class Admin_Controller extends Controller {
$method = "index";
}
- if (!method_exists($controller_name, $method)) {
+ if (!class_exists($controller_name) || !method_exists($controller_name, $method)) {
throw new Kohana_404_Exception();
}
diff --git a/modules/gallery/helpers/block_manager.php b/modules/gallery/helpers/block_manager.php
index bd6ca1c8..a2279468 100644
--- a/modules/gallery/helpers/block_manager.php
+++ b/modules/gallery/helpers/block_manager.php
@@ -35,7 +35,7 @@ class block_manager_Core {
static function activate_blocks($module_name) {
$block_class = "{$module_name}_block";
- if (method_exists($block_class, "get_site_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::add("site_sidebar", $module_name, $block_id);
@@ -61,14 +61,14 @@ class block_manager_Core {
static function deactivate_blocks($module_name) {
$block_class = "{$module_name}_block";
- if (method_exists($block_class, "get_site_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
block_manager::remove_blocks_for_module("site_sidebar", $module_name);
}
}
- if (method_exists($block_class, "get_admin_list")) {
+ if (class_exists($block_class) && method_exists($block_class, "get_admin_list")) {
$blocks = call_user_func(array($block_class, "get_admin_list"));
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
block_manager::remove_blocks_for_module($location, $module_name);
@@ -89,7 +89,7 @@ class block_manager_Core {
foreach (module::active() as $module) {
$class_name = "{$module->name}_block";
- if (method_exists($class_name, $function)) {
+ if (class_exists($class_name) && method_exists($class_name, $function)) {
foreach (call_user_func(array($class_name, $function)) as $id => $title) {
$blocks["{$module->name}:$id"] = $title;
}
@@ -102,7 +102,7 @@ class block_manager_Core {
$active = block_manager::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
- if (method_exists("$desc[0]_block", "get")) {
+ if (class_exists("$desc[0]_block") && method_exists("$desc[0]_block", "get")) {
$block = call_user_func(array("$desc[0]_block", "get"), $desc[1], $theme);
if (!empty($block)) {
$block->id = $id;
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index d7429121..da201d20 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -141,7 +141,7 @@ class module_Core {
$messages = array();
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "can_activate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "can_activate")) {
$messages = call_user_func(array($installer_class, "can_activate"));
}
@@ -173,7 +173,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "install")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "install")) {
call_user_func_array(array($installer_class, "install"), array());
}
module::set_version($module_name, module::available()->$module_name->code_version);
@@ -226,7 +226,7 @@ class module_Core {
$version_before = module::get_version($module_name);
$installer_class = "{$module_name}_installer";
$available = module::available();
- if (method_exists($installer_class, "upgrade")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "upgrade")) {
call_user_func_array(array($installer_class, "upgrade"), array($version_before));
} else {
if (isset($available->$module_name->code_version)) {
@@ -261,7 +261,7 @@ class module_Core {
module::_add_to_path($module_name);
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "activate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "activate")) {
call_user_func_array(array($installer_class, "activate"), array());
}
@@ -288,7 +288,7 @@ class module_Core {
*/
static function deactivate($module_name) {
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "deactivate")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "deactivate")) {
call_user_func_array(array($installer_class, "deactivate"), array());
}
@@ -314,7 +314,7 @@ class module_Core {
*/
static function uninstall($module_name) {
$installer_class = "{$module_name}_installer";
- if (method_exists($installer_class, "uninstall")) {
+ if (class_exists($installer_class) && method_exists($installer_class, "uninstall")) {
call_user_func(array($installer_class, "uninstall"));
}
@@ -403,7 +403,7 @@ class module_Core {
continue;
}
$class = "{$module->name}_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@@ -411,7 +411,7 @@ class module_Core {
// Give the admin theme a chance to respond, if we're in admin mode.
if (theme::$is_admin) {
$class = theme::$admin_theme_name . "_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
@@ -419,7 +419,7 @@ class module_Core {
// Give the site theme a chance to respond as well. It gets a chance even in admin mode, as
// long as the theme has an admin subdir.
$class = theme::$site_theme_name . "_event";
- if (method_exists($class, $function)) {
+ if (class_exists($class) && method_exists($class, $function)) {
call_user_func_array(array($class, $function), $args);
}
}
diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php
index 32fd9739..5638faf4 100644
--- a/modules/gallery/helpers/task.php
+++ b/modules/gallery/helpers/task.php
@@ -25,7 +25,7 @@ class task_Core {
$tasks = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_task";
- if (method_exists($class_name, "available_tasks")) {
+ if (class_exists($class_name) && method_exists($class_name, "available_tasks")) {
foreach (call_user_func(array($class_name, "available_tasks")) as $task) {
$tasks[$task->callback] = $task;
}
diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php
index 83163868..62645d18 100644
--- a/modules/gallery/libraries/Admin_View.php
+++ b/modules/gallery/libraries/Admin_View.php
@@ -95,7 +95,7 @@ class Admin_View_Core extends Gallery_View {
$blocks = array();
foreach (module::active() as $module) {
$helper_class = "{$module->name}_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php
index 23368a6a..525e1695 100644
--- a/modules/gallery/libraries/IdentityProvider.php
+++ b/modules/gallery/libraries/IdentityProvider.php
@@ -81,7 +81,8 @@ class IdentityProvider_Core {
module::set_var("gallery", "identity_provider", $new_provider);
- if (method_exists("{$new_provider}_installer", "initialize")) {
+ if (class_exists("{$new_provider}_installer") &&
+ method_exists("{$new_provider}_installer", "initialize")) {
call_user_func("{$new_provider}_installer::initialize");
}
diff --git a/modules/gallery/libraries/MY_Kohana.php b/modules/gallery/libraries/MY_Kohana.php
deleted file mode 100644
index d344c8ed..00000000
--- a/modules/gallery/libraries/MY_Kohana.php
+++ /dev/null
@@ -1,45 +0,0 @@
-= 3)) {
- // Load a dummy class instead.
- eval("class $class {}");
- }
-
- // Return the same result.
- return $found;
- }
-}
\ No newline at end of file
diff --git a/modules/gallery/libraries/SafeString.php b/modules/gallery/libraries/SafeString.php
index 31e9d31b..179cbd41 100644
--- a/modules/gallery/libraries/SafeString.php
+++ b/modules/gallery/libraries/SafeString.php
@@ -153,7 +153,7 @@ class SafeString_Core {
* Purify the string, removing any potentially malicious or unsafe HTML / JavaScript.
*/
private static function _purify_for_html($dirty_html) {
- if (method_exists("purifier", "purify")) {
+ if (class_exists("purifier") && method_exists("purifier", "purify")) {
return purifier::purify($dirty_html);
} else {
return self::_escape_for_html($dirty_html);
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 986fc8a2..0a4c96e1 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -239,7 +239,7 @@ class Theme_View_Core extends Gallery_View {
continue;
}
$helper_class = "{$module->name}_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
@@ -247,7 +247,7 @@ class Theme_View_Core extends Gallery_View {
}
$helper_class = theme::$site_theme_name . "_theme";
- if (method_exists($helper_class, $function)) {
+ if (class_exists($helper_class) && method_exists($helper_class, $function)) {
$blocks[] = call_user_func_array(
array($helper_class, $function),
array_merge(array($this), $args));
diff --git a/modules/gallery/tests/Html_Helper_Test.php b/modules/gallery/tests/Html_Helper_Test.php
index 476faa5a..4643e6fd 100644
--- a/modules/gallery/tests/Html_Helper_Test.php
+++ b/modules/gallery/tests/Html_Helper_Test.php
@@ -27,7 +27,7 @@ class Html_Helper_Test extends Gallery_Unit_Test_Case {
public function purify_test() {
$safe_string = html::purify("hello world
");
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello world
"
: "hello <p >world</p>";
$this->assert_equal($expected, $safe_string->unescaped());
diff --git a/modules/gallery/tests/SafeString_Test.php b/modules/gallery/tests/SafeString_Test.php
index 946410d4..dab7d7df 100644
--- a/modules/gallery/tests/SafeString_Test.php
+++ b/modules/gallery/tests/SafeString_Test.php
@@ -91,7 +91,7 @@ class SafeString_Test extends Gallery_Unit_Test_Case {
public function purify_test() {
$safe_string = SafeString::purify("hello world
");
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello world
"
: "hello <p >world</p>";
$this->assert_equal($expected, $safe_string);
@@ -100,7 +100,7 @@ class SafeString_Test extends Gallery_Unit_Test_Case {
public function purify_twice_test() {
$safe_string = SafeString::purify("hello world
");
$safe_string_2 = SafeString::purify($safe_string);
- $expected = method_exists("purifier", "purify")
+ $expected = (class_exists("purifier") && method_exists("purifier", "purify"))
? "hello world
"
: "hello <p >world</p>";
$this->assert_equal($expected, $safe_string_2);
diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php
index 54ca6fe9..b3d59e0f 100644
--- a/modules/rest/controllers/rest.php
+++ b/modules/rest/controllers/rest.php
@@ -98,7 +98,7 @@ class Rest_Controller extends Controller {
$handler_class = "{$function}_rest";
$handler_method = $request->method;
- if (!method_exists($handler_class, $handler_method)) {
+ if (!class_exists($handler_class) || !method_exists($handler_class, $handler_method)) {
throw new Rest_Exception("Bad Request", 400);
}
diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php
index 9b367feb..c6be1e1d 100644
--- a/modules/rest/helpers/rest.php
+++ b/modules/rest/helpers/rest.php
@@ -141,7 +141,7 @@ class rest_Core {
}
$class = "$components[1]_rest";
- if (!method_exists($class, "resolve")) {
+ if (!class_exists($class) || !method_exists($class, "resolve")) {
throw new Kohana_404_Exception($url);
}
@@ -158,7 +158,7 @@ class rest_Core {
$resource_type = array_shift($args);
$class = "{$resource_type}_rest";
- if (!method_exists($class, "url")) {
+ if (!class_exists($class) || !method_exists($class, "url")) {
throw new Rest_Exception("Bad Request", 400);
}
@@ -178,7 +178,7 @@ class rest_Core {
foreach (module::active() as $module) {
foreach (glob(MODPATH . "{$module->name}/helpers/*_rest.php") as $filename) {
$class = str_replace(".php", "", basename($filename));
- if (method_exists($class, "relationships")) {
+ if (class_exists($class) && method_exists($class, "relationships")) {
if ($tmp = call_user_func(array($class, "relationships"), $resource_type, $resource)) {
$results = array_merge($results, $tmp);
}
diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php
index 12461325..571995b3 100644
--- a/modules/rss/controllers/rss.php
+++ b/modules/rss/controllers/rss.php
@@ -32,7 +32,7 @@ class Rss_Controller extends Controller {
// Run the appropriate feed callback
if (module::is_active($module_id)) {
$class_name = "{$module_id}_rss";
- if (method_exists($class_name, "feed")) {
+ if (class_exists($class_name) && method_exists($class_name, "feed")) {
$feed = call_user_func(
array($class_name, "feed"), $feed_id,
($page - 1) * $page_size, $page_size, $id);
diff --git a/modules/rss/helpers/rss_block.php b/modules/rss/helpers/rss_block.php
index 74334e93..9a77b05d 100644
--- a/modules/rss/helpers/rss_block.php
+++ b/modules/rss/helpers/rss_block.php
@@ -29,7 +29,7 @@ class rss_block_Core {
$feeds = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_rss";
- if (method_exists($class_name, "available_feeds")) {
+ if (class_exists($class_name) && method_exists($class_name, "available_feeds")) {
$feeds = array_merge($feeds,
call_user_func(array($class_name, "available_feeds"), $theme->item(), $theme->tag()));
}
--
cgit v1.2.3
From e7b224461a4137666f97eb23c063bbb2bf5fdc7a Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Sun, 3 Mar 2013 00:16:38 +0100
Subject: #2034 - Add webm and ogv as valid movie types. - added them to
legal_file helper - revised unit tests
---
modules/gallery/helpers/legal_file.php | 3 ++-
modules/gallery/tests/Legal_File_Helper_Test.php | 14 +++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/helpers/legal_file.php b/modules/gallery/helpers/legal_file.php
index eb9c25de..f8547011 100644
--- a/modules/gallery/helpers/legal_file.php
+++ b/modules/gallery/helpers/legal_file.php
@@ -70,7 +70,8 @@ class legal_file_Core {
if (empty(self::$movie_types_by_extension)) {
$types_by_extension_wrapper = new stdClass();
$types_by_extension_wrapper->types_by_extension = array(
- "flv" => "video/x-flv", "mp4" => "video/mp4", "m4v" => "video/x-m4v");
+ "flv" => "video/x-flv", "mp4" => "video/mp4", "m4v" => "video/x-m4v",
+ "webm" => "video/webm", "ogv" => "video/ogg");
module::event("movie_types_by_extension", $types_by_extension_wrapper);
foreach (self::$blacklist as $key) {
unset($types_by_extension_wrapper->types_by_extension[$key]);
diff --git a/modules/gallery/tests/Legal_File_Helper_Test.php b/modules/gallery/tests/Legal_File_Helper_Test.php
index 7ed5214b..3f520131 100644
--- a/modules/gallery/tests/Legal_File_Helper_Test.php
+++ b/modules/gallery/tests/Legal_File_Helper_Test.php
@@ -37,7 +37,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_equal(null, legal_file::get_movie_types_by_extension("php.flv")); // invalid w/ .
// No extension returns full array
- $this->assert_equal(3, count(legal_file::get_movie_types_by_extension()));
+ $this->assert_equal(5, count(legal_file::get_movie_types_by_extension()));
}
public function get_types_by_extension_test() {
@@ -47,7 +47,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_equal(null, legal_file::get_types_by_extension("php.flv")); // invalid w/ .
// No extension returns full array
- $this->assert_equal(7, count(legal_file::get_types_by_extension()));
+ $this->assert_equal(9, count(legal_file::get_types_by_extension()));
}
public function get_photo_extensions_test() {
@@ -69,7 +69,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_equal(false, legal_file::get_movie_extensions("php.jpg")); // invalid w/ .
// No extension returns full array
- $this->assert_equal(3, count(legal_file::get_movie_extensions()));
+ $this->assert_equal(5, count(legal_file::get_movie_extensions()));
}
public function get_extensions_test() {
@@ -79,12 +79,12 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
$this->assert_equal(false, legal_file::get_extensions("php.jpg")); // invalid w/ .
// No extension returns full array
- $this->assert_equal(7, count(legal_file::get_extensions()));
+ $this->assert_equal(9, count(legal_file::get_extensions()));
}
public function get_filters_test() {
- // All 7 extensions both uppercase and lowercase
- $this->assert_equal(14, count(legal_file::get_filters()));
+ // All 9 extensions both uppercase and lowercase
+ $this->assert_equal(18, count(legal_file::get_filters()));
}
public function get_photo_types_test() {
@@ -94,7 +94,7 @@ class Legal_File_Helper_Test extends Gallery_Unit_Test_Case {
public function get_movie_types_test() {
// Note that this is one *more* than movie extensions since video/flv is added.
- $this->assert_equal(4, count(legal_file::get_movie_types()));
+ $this->assert_equal(6, count(legal_file::get_movie_types()));
}
public function change_extension_test() {
--
cgit v1.2.3
From 9d7d6c50bb7713038231232f433ae28f6f117b95 Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Sun, 3 Mar 2013 00:45:03 +0100
Subject: Follow-on to #2033 - Rename movieplayer.html.php to
movieplayer-flash.html.php - renamed file with "-flash" to make room for
html5 player - updated item model and xss_data.txt to reflect changes
--HG--
rename : modules/gallery/views/movieplayer.html.php => modules/gallery/views/movieplayer-flash.html.php
---
modules/gallery/models/item.php | 4 +-
modules/gallery/tests/xss_data.txt | 14 +++----
modules/gallery/views/movieplayer-flash.html.php | 49 ++++++++++++++++++++++++
modules/gallery/views/movieplayer.html.php | 49 ------------------------
4 files changed, 58 insertions(+), 58 deletions(-)
create mode 100644 modules/gallery/views/movieplayer-flash.html.php
delete mode 100644 modules/gallery/views/movieplayer.html.php
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 43b9a292..01da010e 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -751,7 +751,7 @@ class Item_Model_Core extends ORM_MPTT {
// Not set correctly, likely because ffmpeg isn't available. Making the window 0x0 causes the
// video to be effectively unviewable. So, let's guess: set width to max_size and guess a
// height (using 4:3 aspect ratio). Once the video metadata is loaded, js in
- // movieplayer.html.php will correct these values.
+ // movieplayer-flash.html.php will correct these values.
$width = $max_size;
$height = ceil($width * 3/4);
}
@@ -784,7 +784,7 @@ class Item_Model_Core extends ORM_MPTT {
if (in_array(strtolower(pathinfo($this->name, PATHINFO_EXTENSION)),
array("flv", "mp4", "m4v", "mov", "f4v"))) {
// Filetype supported by Flowplayer v3 - use it (default)
- $view = new View("movieplayer.html");
+ $view = new View("movieplayer-flash.html");
$view->max_size = $movie_img->max_size;
$view->width = $movie_img->width;
$view->height = $movie_img->height;
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index daba878d..b365553a 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -223,13 +223,13 @@ modules/gallery/views/menu_dialog.html.php 5 DIRTY_JS $menu-
modules/gallery/views/menu_link.html.php 3 DIRTY $menu->css_id?"id='{$menu->css_id}'":""
modules/gallery/views/menu_link.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu_link.html.php 5 DIRTY_JS $menu->url
-modules/gallery/views/movieplayer.html.php 2 DIRTY html::anchor($url,"",$attrs)
-modules/gallery/views/movieplayer.html.php 4 DIRTY_JS $attrs["id"]
-modules/gallery/views/movieplayer.html.php 5 DIRTY_JS $max_size
-modules/gallery/views/movieplayer.html.php 23 DIRTY_JS url::abs_file("lib/flowplayer.swf")
-modules/gallery/views/movieplayer.html.php 30 DIRTY_JS url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf")
-modules/gallery/views/movieplayer.html.php 48 DIRTY_JS $width
-modules/gallery/views/movieplayer.html.php 48 DIRTY_JS $height
+modules/gallery/views/movieplayer-flash.html.php 2 DIRTY html::anchor($url,"",$attrs)
+modules/gallery/views/movieplayer-flash.html.php 4 DIRTY_JS $attrs["id"]
+modules/gallery/views/movieplayer-flash.html.php 5 DIRTY_JS $max_size
+modules/gallery/views/movieplayer-flash.html.php 23 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.swf")
+modules/gallery/views/movieplayer-flash.html.php 30 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.pseudostreaming-byterange.swf")
+modules/gallery/views/movieplayer-flash.html.php 48 DIRTY_JS $width
+modules/gallery/views/movieplayer-flash.html.php 48 DIRTY_JS $height
modules/gallery/views/permissions_browse.html.php 3 DIRTY_JS url::site("permissions/form/__ITEM__")
modules/gallery/views/permissions_browse.html.php 16 DIRTY_JS url::site("permissions/change/__CMD__/__GROUP__/__PERM__/__ITEM__?csrf=$csrf")
modules/gallery/views/permissions_browse.html.php 43 DIRTY_ATTR $parent->id
diff --git a/modules/gallery/views/movieplayer-flash.html.php b/modules/gallery/views/movieplayer-flash.html.php
new file mode 100644
index 00000000..6d3cee2a
--- /dev/null
+++ b/modules/gallery/views/movieplayer-flash.html.php
@@ -0,0 +1,49 @@
+
+= html::anchor($url, "", $attrs) ?>
+
diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php
deleted file mode 100644
index 6d3cee2a..00000000
--- a/modules/gallery/views/movieplayer.html.php
+++ /dev/null
@@ -1,49 +0,0 @@
-
-= html::anchor($url, "", $attrs) ?>
-
--
cgit v1.2.3
From d2577c066ba7698583c4a7fd823751876dadab6e Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Tue, 5 Mar 2013 21:27:44 -0500
Subject: Follow-on to 384bc7afc86be706bf61def09afc8306cdad2443 for #2033
Update golden file for XSS test.
---
modules/gallery/tests/xss_data.txt | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index b365553a..9c796999 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -223,13 +223,13 @@ modules/gallery/views/menu_dialog.html.php 5 DIRTY_JS $menu-
modules/gallery/views/menu_link.html.php 3 DIRTY $menu->css_id?"id='{$menu->css_id}'":""
modules/gallery/views/menu_link.html.php 4 DIRTY_ATTR $menu->css_class
modules/gallery/views/menu_link.html.php 5 DIRTY_JS $menu->url
-modules/gallery/views/movieplayer-flash.html.php 2 DIRTY html::anchor($url,"",$attrs)
-modules/gallery/views/movieplayer-flash.html.php 4 DIRTY_JS $attrs["id"]
-modules/gallery/views/movieplayer-flash.html.php 5 DIRTY_JS $max_size
-modules/gallery/views/movieplayer-flash.html.php 23 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.swf")
-modules/gallery/views/movieplayer-flash.html.php 30 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.pseudostreaming-byterange.swf")
-modules/gallery/views/movieplayer-flash.html.php 48 DIRTY_JS $width
-modules/gallery/views/movieplayer-flash.html.php 48 DIRTY_JS $height
+modules/gallery/views/movieplayer-flash.html.php 3 DIRTY html::anchor($url,"",$attrs)
+modules/gallery/views/movieplayer-flash.html.php 5 DIRTY_JS $attrs["id"]
+modules/gallery/views/movieplayer-flash.html.php 6 DIRTY_JS $max_size
+modules/gallery/views/movieplayer-flash.html.php 24 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.swf")
+modules/gallery/views/movieplayer-flash.html.php 31 DIRTY_JS url::abs_file("lib/flowplayer-flash/flowplayer.pseudostreaming-byterange.swf")
+modules/gallery/views/movieplayer-flash.html.php 49 DIRTY_JS $width
+modules/gallery/views/movieplayer-flash.html.php 49 DIRTY_JS $height
modules/gallery/views/permissions_browse.html.php 3 DIRTY_JS url::site("permissions/form/__ITEM__")
modules/gallery/views/permissions_browse.html.php 16 DIRTY_JS url::site("permissions/change/__CMD__/__GROUP__/__PERM__/__ITEM__?csrf=$csrf")
modules/gallery/views/permissions_browse.html.php 43 DIRTY_ATTR $parent->id
@@ -435,18 +435,18 @@ themes/wind/views/page.html.php 10 DIRTY $page_
themes/wind/views/page.html.php 32 DIRTY $new_width
themes/wind/views/page.html.php 33 DIRTY $new_height
themes/wind/views/page.html.php 34 DIRTY $thumb_proportion
-themes/wind/views/page.html.php 74 DIRTY_JS $theme->url()
-themes/wind/views/page.html.php 79 DIRTY $theme->get_combined("css")
-themes/wind/views/page.html.php 82 DIRTY $theme->get_combined("script")
-themes/wind/views/page.html.php 92 DIRTY $header_text
-themes/wind/views/page.html.php 94 DIRTY_JS item::root()->url()
-themes/wind/views/page.html.php 98 DIRTY $theme->user_menu()
-themes/wind/views/page.html.php 113 DIRTY_ATTR $breadcrumb->last?"g-active":""
-themes/wind/views/page.html.php 114 DIRTY_ATTR $breadcrumb->first?"g-first":""
-themes/wind/views/page.html.php 115 DIRTY_JS $breadcrumb->url
-themes/wind/views/page.html.php 128 DIRTY $content
-themes/wind/views/page.html.php 134 DIRTY newView("sidebar.html")
-themes/wind/views/page.html.php 141 DIRTY $footer_text
+themes/wind/views/page.html.php 68 DIRTY_JS $theme->url()
+themes/wind/views/page.html.php 73 DIRTY $theme->get_combined("css")
+themes/wind/views/page.html.php 76 DIRTY $theme->get_combined("script")
+themes/wind/views/page.html.php 86 DIRTY $header_text
+themes/wind/views/page.html.php 88 DIRTY_JS item::root()->url()
+themes/wind/views/page.html.php 92 DIRTY $theme->user_menu()
+themes/wind/views/page.html.php 107 DIRTY_ATTR $breadcrumb->last?"g-active":""
+themes/wind/views/page.html.php 108 DIRTY_ATTR $breadcrumb->first?"g-first":""
+themes/wind/views/page.html.php 109 DIRTY_JS $breadcrumb->url
+themes/wind/views/page.html.php 122 DIRTY $content
+themes/wind/views/page.html.php 128 DIRTY newView("sidebar.html")
+themes/wind/views/page.html.php 135 DIRTY $footer_text
themes/wind/views/paginator.html.php 33 DIRTY_JS $first_page_url
themes/wind/views/paginator.html.php 42 DIRTY_JS $previous_page_url
themes/wind/views/paginator.html.php 70 DIRTY_JS $next_page_url
--
cgit v1.2.3
From dc7bf9486f9eaa3f8633c51c786434cec1605834 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 6 Mar 2013 14:33:24 -0500
Subject: Follow-on for #2043. Fix some tests that made bad assumptions about
the state of the world. These were uncovered when we ran the tests on Travis
which runs the tests in a different order than what I (and apparently others)
use on their dev boxes.
---
modules/gallery/tests/Item_Model_Test.php | 2 ++
1 file changed, 2 insertions(+)
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index fcb5c2ad..83c9f79d 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -362,6 +362,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$response = item::root()->as_restful_array();
$this->assert_true($response["can_edit"]);
+ access::deny(identity::everybody(), "edit", item::root());
identity::set_active_user(identity::guest());
$response = item::root()->as_restful_array();
$this->assert_false($response["can_edit"]);
@@ -371,6 +372,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
$response = item::root()->as_restful_array();
$this->assert_true($response["can_add"]);
+ access::deny(identity::everybody(), "add", item::root());
identity::set_active_user(identity::guest());
$response = item::root()->as_restful_array();
$this->assert_false($response["can_add"]);
--
cgit v1.2.3
From 18f38f0dff93665267bd1497b196d9270fdbdc88 Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Sat, 9 Mar 2013 12:51:45 +0100
Subject: #2046 - Change Gallery over to using MediaElementJS as its movie
player.
---
modules/gallery/helpers/gallery_theme.php | 4 ++
modules/gallery/models/item.php | 72 ++++++++++++------------
modules/gallery/tests/xss_data.txt | 14 ++---
modules/gallery/views/movieplayer-flash.html.php | 50 ----------------
modules/gallery/views/movieplayer.html.php | 17 ++++++
themes/wind/css/screen.css | 2 +-
6 files changed, 66 insertions(+), 93 deletions(-)
delete mode 100644 modules/gallery/views/movieplayer-flash.html.php
create mode 100644 modules/gallery/views/movieplayer.html.php
(limited to 'modules/gallery/tests')
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index 3c6d71e9..e5f6b0b4 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -49,6 +49,10 @@ class gallery_theme_Core {
. $theme->script("l10n_client.js");
}
+ // Add MediaElementJS library
+ $buf .= $theme->script("mediaelementjs/mediaelement.js");
+ $buf .= $theme->script("mediaelementjs/mediaelementplayer.js");
+ $buf .= $theme->css("mediaelementjs/mediaelementplayer.css");
$buf .= $theme->css("uploadify/uploadify.css");
return $buf;
}
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index e8afaec3..1e16d307 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -737,40 +737,42 @@ class Item_Model_Core extends ORM_MPTT {
}
/**
- * Return a view for movies. By default this is a Flowplayer v3
-= html::anchor($url, "", $attrs) ?>
-
diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php
new file mode 100644
index 00000000..f78cc91a
--- /dev/null
+++ b/modules/gallery/views/movieplayer.html.php
@@ -0,0 +1,17 @@
+
+>
+ >
+ >
+
+
+
diff --git a/themes/wind/css/screen.css b/themes/wind/css/screen.css
index cbeaed34..fa1704b0 100644
--- a/themes/wind/css/screen.css
+++ b/themes/wind/css/screen.css
@@ -531,7 +531,7 @@ td {
}
#g-item img.g-resize,
-#g-item a.g-movie {
+#g-item .g-movie {
display: block;
margin: 0 auto;
}
--
cgit v1.2.3
From b43349f4de3612da1757a9293d205e081640e106 Mon Sep 17 00:00:00 2001
From: shadlaws
Date: Sun, 10 Mar 2013 22:08:16 +0100
Subject: #2048 - Remove unneeded jquery.autocomplete.css/js inclusions. -
removed autocomplete.css/js calls in server_add, tag, and g2_import. -
revised xss_data.txt golden file (line number changes only).
---
modules/g2_import/views/admin_g2_import.html.php | 2 --
modules/gallery/tests/xss_data.txt | 10 +++++-----
modules/server_add/views/admin_server_add.html.php | 2 --
modules/tag/helpers/tag_theme.php | 4 +---
4 files changed, 6 insertions(+), 12 deletions(-)
(limited to 'modules/gallery/tests')
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index fd9487e4..adde83ce 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -1,6 +1,4 @@
-= $theme->css("jquery.autocomplete.css") ?>
-= $theme->script("jquery.autocomplete.js") ?>