summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/legal_file.php3
-rw-r--r--modules/gallery/models/item.php4
-rw-r--r--modules/gallery/tests/Legal_File_Helper_Test.php14
-rw-r--r--modules/gallery/tests/xss_data.txt14
-rw-r--r--modules/gallery/views/movieplayer-flash.html.php (renamed from modules/gallery/views/movieplayer.html.php)4
-rw-r--r--modules/gallery_unit_test/controllers/gallery_unit_test.php11
-rw-r--r--modules/unit_test/libraries/Unit_Test.php8
7 files changed, 37 insertions, 21 deletions
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/models/item.php b/modules/gallery/models/item.php
index ffbeb6f2..0443a144 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/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() {
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.html.php b/modules/gallery/views/movieplayer-flash.html.php
index edb5184c..6d3cee2a 100644
--- a/modules/gallery/views/movieplayer.html.php
+++ b/modules/gallery/views/movieplayer-flash.html.php
@@ -20,14 +20,14 @@
// setup flowplayer
flowplayer(id,
$.extend(true, {
- "src": "<?= url::abs_file("lib/flowplayer.swf") ?>",
+ "src": "<?= url::abs_file("lib/flowplayer-flash/flowplayer.swf") ?>",
"wmode": "transparent",
"provider": "pseudostreaming"
}, <?= json_encode($fp_params) ?>),
$.extend(true, {
"plugins": {
"pseudostreaming": {
- "url": "<?= url::abs_file("lib/flowplayer.pseudostreaming-byterange.swf") ?>"
+ "url": "<?= url::abs_file("lib/flowplayer-flash/flowplayer.pseudostreaming-byterange.swf") ?>"
},
"controls": {
"autoHide": "always",
diff --git a/modules/gallery_unit_test/controllers/gallery_unit_test.php b/modules/gallery_unit_test/controllers/gallery_unit_test.php
index 67d006b3..55d0abc1 100644
--- a/modules/gallery_unit_test/controllers/gallery_unit_test.php
+++ b/modules/gallery_unit_test/controllers/gallery_unit_test.php
@@ -27,6 +27,9 @@ class Gallery_Unit_Test_Controller extends Controller {
ini_set("display_errors", true);
error_reporting(-1);
+ // Track whether all tests pass so we can return an appropriate code to the CLI
+ $all_tests_passed = false;
+
// Jump through some hoops to satisfy the way that we check for the site_domain in
// config.php. We structure this such that the code in config will leave us with a
// site_domain of "." (for historical reasons)
@@ -132,7 +135,7 @@ class Gallery_Unit_Test_Controller extends Controller {
graphics::choose_default_toolkit();
$filter = count($_SERVER["argv"]) > 2 ? $_SERVER["argv"][2] : null;
- print new Unit_Test($modules, $filter);
+ print new Unit_Test($modules, $filter, $all_tests_passed);
} catch (ORM_Validation_Exception $e) {
print "Validation Exception: {$e->getMessage()}\n";
print $e->getTraceAsString() . "\n";
@@ -143,5 +146,11 @@ class Gallery_Unit_Test_Controller extends Controller {
print "Exception: {$e->getMessage()}\n";
print $e->getTraceAsString() . "\n";
}
+
+ // Let the CLI caller know whether all tests passed or not,
+ // to allow usage of continuous integration servers.
+ if (PHP_SAPI == 'cli') {
+ exit($all_tests_passed ? 0 : 1);
+ }
}
}
diff --git a/modules/unit_test/libraries/Unit_Test.php b/modules/unit_test/libraries/Unit_Test.php
index 253d6fb6..15306f7e 100644
--- a/modules/unit_test/libraries/Unit_Test.php
+++ b/modules/unit_test/libraries/Unit_Test.php
@@ -67,9 +67,10 @@ class Unit_Test_Core {
*
* @param array test path(s)
* @param string filter (regular expression)
+ * @param boolean will be set to true if all tests pass
* @return void
*/
- public function __construct($extra_paths=array(), $filter=null)
+ public function __construct($extra_paths=array(), $filter=null, $all_passed=null)
{
// Merge possible default test path(s) from config with the rest
$paths = array_merge($extra_paths, Kohana::config('unit_test.paths', FALSE, FALSE));
@@ -83,6 +84,9 @@ class Unit_Test_Core {
// Take out duplicate test paths after normalization
$this->paths = array_unique($paths);
+ // Assume all tests will pass
+ $all_passed = true;
+
// Loop over each given test path
foreach ($this->paths as $path)
{
@@ -216,6 +220,7 @@ class Unit_Test_Core {
// Test failed
$this->results[$class][$method_name] = $e;
$this->stats[$class]['failed']++;
+ $all_passed = false;
}
catch (Exception $e)
{
@@ -224,6 +229,7 @@ class Unit_Test_Core {
// Test error
$this->results[$class][$method_name] = $e;
$this->stats[$class]['errors']++;
+ $all_passed = false;
}
// Calculate score