summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-01-24 18:14:28 -0500
committerBharat Mediratta <bharat@menalto.com>2013-01-24 18:14:28 -0500
commit03535786307c60f0f79ce4f773c9c1a8e43826ed (patch)
tree5ef1329cfaea5ab43dd9d28cb8aa48c0a34e1eed /modules
parent86a2759062ee3dbf93f4c17c7499e3f506035047 (diff)
parent98d09c3740f1c19e477a71bdb44791306d7bd05b (diff)
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_installer.php6
-rw-r--r--modules/gallery/helpers/movie.php6
-rw-r--r--modules/gallery/tests/File_Structure_Test.php18
-rw-r--r--modules/gallery/tests/Gallery_Filters.php4
-rw-r--r--modules/gallery/tests/Item_Model_Test.php8
-rw-r--r--modules/gallery/views/movieplayer.html.php2
-rw-r--r--modules/gallery_unit_test/helpers/test.php28
-rw-r--r--modules/info/helpers/info_block.php2
-rw-r--r--modules/organize/views/organize_frame.html.php6
9 files changed, 64 insertions, 16 deletions
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 91c785f6..fe651a4e 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -718,14 +718,14 @@ class gallery_installer {
if ($version == 50) {
// In v51, we added a lock_timeout variable so that administrators could edit the time out
- // from 1 second to a higher variable if their system runs concurrent parallel uploads for
+ // from 1 second to a higher variable if their system runs concurrent parallel uploads for
// instance.
module::set_var("gallery", "lock_timeout", 1);
module::set_version("gallery", $version = 51);
}
if ($version == 51) {
- // In v52, we added functions to the legal_file helper that map photo and movie file
+ // In v52, we added functions to the legal_file helper that map photo and movie file
// extensions to their mime types (and allow extension of the list by other modules). During
// this process, we correctly mapped m4v files to video/x-m4v, correcting a previous error
// where they were mapped to video/mp4. This corrects the existing items.
@@ -736,7 +736,7 @@ class gallery_installer {
->execute();
module::set_version("gallery", $version = 52);
}
-
+
if ($version == 52) {
// In v53, we added the ability to change the default time used when extracting frames from
// movies. Previously we hard-coded this at 3 seconds, so we use that as the default.
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index fb3fab80..7e6a2e55 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -82,7 +82,7 @@ class movie_Core {
// extract frame at start_time, unless movie is too short
$start_time_arg = ($duration >= $start_time + 0.1) ?
"-ss " . movie::seconds_to_hhmmssdd($start_time) : "";
-
+
$input_args = isset($movie_options["input_args"]) ? $movie_options["input_args"] : "";
$output_args = isset($movie_options["output_args"]) ? $movie_options["output_args"] : "";
@@ -164,7 +164,7 @@ class movie_Core {
* Return the time/duration formatted in hh:mm:ss.dd from a number of seconds.
* Useful for inputs to ffmpeg.
*
- * Note that this is similar to date("H:i:s", mktime(0,0,$seconds,0,0,0,0)), but unlike this
+ * Note that this is similar to date("H:i:s", mktime(0,0,$seconds,0,0,0,0)), but unlike this
* approach avoids potential issues with time zone and DST mismatch and/or using deprecated
* features (the last argument of mkdate above, which disables DST, is deprecated as of PHP 5.3).
*/
@@ -172,7 +172,7 @@ class movie_Core {
return sprintf("%02d:%02d:%05.2f", floor($seconds / 3600), floor(($seconds % 3600) / 60),
floor(100 * $seconds % 6000) / 100);
}
-
+
/**
* Return the number of seconds from a time/duration formatted in hh:mm:ss.dd.
* Useful for outputs from ffmpeg.
diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php
index 7ad865e0..ce75ea13 100644
--- a/modules/gallery/tests/File_Structure_Test.php
+++ b/modules/gallery/tests/File_Structure_Test.php
@@ -285,7 +285,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
}
public function all_public_functions_in_test_files_end_in_test() {
- // Who tests the tests? :-)
+ // Who tests the tests? :-) (ref: http://www.xkcd.com/1163)
$dir = new PhpCodeFilterIterator(
new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(
@@ -315,4 +315,20 @@ class File_Structure_Test extends Gallery_Unit_Test_Case {
}
}
}
+
+ public function no_extra_spaces_at_end_of_line_test() {
+ $dir = new GalleryCodeFilterIterator(
+ new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
+ $errors = "";
+ foreach ($dir as $file) {
+ if (preg_match("/\.(php|css|html|js)$/", $file)) {
+ foreach (file($file) as $line_num => $line) {
+ if ((substr($line, -2) == " \n") || (substr($line, -1) == " ")) {
+ $errors .= "$file at line " . ($line_num + 1) . "\n";
+ }
+ }
+ }
+ }
+ $this->assert_true(empty($errors), "Extra spaces at end of line found at:\n$errors");
+ }
}
diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php
index 83dbd53f..6c2a6aa3 100644
--- a/modules/gallery/tests/Gallery_Filters.php
+++ b/modules/gallery/tests/Gallery_Filters.php
@@ -47,6 +47,10 @@ class GalleryCodeFilterIterator extends FilterIterator {
strpos($path_name, SYSPATH) !== false ||
strpos($path_name, MODPATH . "gallery/libraries/HTMLPurifier") !== false ||
strpos($path_name, MODPATH . "gallery/vendor/joomla") !== false ||
+ strpos($path_name, MODPATH . "organize/vendor/ext") !== false ||
+ strpos($path_name, DOCROOT . "lib") !== false ||
+ strpos($path_name, DOCROOT . "themes/admin_wind/css/themeroller") !== false ||
+ strpos($path_name, DOCROOT . "themes/wind/css/themeroller") !== false ||
substr($path_name, -1, 1) == "~");
}
}
diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php
index a7eba1ad..c45bbc3c 100644
--- a/modules/gallery/tests/Item_Model_Test.php
+++ b/modules/gallery/tests/Item_Model_Test.php
@@ -66,7 +66,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
}
public function rename_photo_test() {
- $item = test::random_photo();
+ $item = test::random_unique_photo();
$original_name = $item->name;
$thumb_file = file_get_contents($item->thumb_path());
@@ -89,7 +89,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function rename_album_test() {
$album = test::random_album();
- $photo = test::random_photo($album);
+ $photo = test::random_unique_photo($album);
$album->reload();
$thumb_file = file_get_contents($photo->thumb_path());
@@ -152,7 +152,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function move_album_test() {
$album2 = test::random_album();
$album1 = test::random_album($album2);
- $photo = test::random_photo($album1);
+ $photo = test::random_unique_photo($album1);
$thumb_file = file_get_contents($photo->thumb_path());
$resize_file = file_get_contents($photo->resize_path());
@@ -180,7 +180,7 @@ class Item_Model_Test extends Gallery_Unit_Test_Case {
public function move_photo_test() {
$album1 = test::random_album();
- $photo = test::random_photo($album1);
+ $photo = test::random_unique_photo($album1);
$album2 = test::random_album();
diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php
index 25cb9f58..edb5184c 100644
--- a/modules/gallery/views/movieplayer.html.php
+++ b/modules/gallery/views/movieplayer.html.php
@@ -18,7 +18,7 @@
$("#" + id).css({width: width, height: height});
};
// setup flowplayer
- flowplayer(id,
+ flowplayer(id,
$.extend(true, {
"src": "<?= url::abs_file("lib/flowplayer.swf") ?>",
"wmode": "transparent",
diff --git a/modules/gallery_unit_test/helpers/test.php b/modules/gallery_unit_test/helpers/test.php
index 3ccb35ca..75cf9b33 100644
--- a/modules/gallery_unit_test/helpers/test.php
+++ b/modules/gallery_unit_test/helpers/test.php
@@ -63,6 +63,34 @@ class test_Core {
return test::random_photo_unsaved($parent)->save()->reload();
}
+ // If a test compares photo file contents (i.e. file_get_contents), it's best to use this
+ // function to guarantee uniqueness.
+ static function random_unique_photo_unsaved($parent=null) {
+ $rand = test::random_string(6);
+ $photo = ORM::factory("item");
+ $photo->type = "photo";
+ $photo->parent_id = $parent ? $parent->id : 1;
+ if (function_exists("gd_info")) {
+ // Make image unique - color the black dot of test.jpg to the 6-digit hex code of rand.
+ $image = imagecreatefromjpeg(MODPATH . "gallery/tests/test.jpg");
+ imagefilter($image, IMG_FILTER_COLORIZE,
+ hexdec(substr($rand, 0, 2)), hexdec(substr($rand, 2, 2)), hexdec(substr($rand, 4, 2)));
+ imagejpeg($image, TMPPATH . "test_$rand.jpg");
+ imagedestroy($image);
+ $photo->set_data_file(TMPPATH . "test_$rand.jpg");
+ } else {
+ // Just use the black dot.
+ $photo->set_data_file(MODPATH . "gallery/tests/test.jpg");
+ }
+ $photo->name = "name_$rand.jpg";
+ $photo->title = "title_$rand";
+ return $photo;
+ }
+
+ static function random_unique_photo($parent=null) {
+ return test::random_unique_photo_unsaved($parent)->save()->reload();
+ }
+
static function random_user($password="password") {
$rand = "name_" . test::random_string(6);
return identity::create_user($rand, $rand, $password, "$rand@rand.com");
diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php
index 4079fe55..62aa0746 100644
--- a/modules/info/helpers/info_block.php
+++ b/modules/info/helpers/info_block.php
@@ -29,7 +29,7 @@ class info_block_Core {
if ($theme->item()) {
$block = new Block();
$block->css_id = "g-metadata";
- $block->title = $theme->item()->is_album() ? t("Album info") :
+ $block->title = $theme->item()->is_album() ? t("Album info") :
($theme->item()->is_movie() ? t("Movie info") : t("Photo info"));
$block->content = new View("info_block.html");
if ($theme->item->title && module::get_var("info", "show_title")) {
diff --git a/modules/organize/views/organize_frame.html.php b/modules/organize/views/organize_frame.html.php
index c33b7607..b1d92675 100644
--- a/modules/organize/views/organize_frame.html.php
+++ b/modules/organize/views/organize_frame.html.php
@@ -365,7 +365,7 @@
}
}
});
-
+
var tag_button = new Ext.Button({
flex: 2,
text: <?= t("Tag")->for_js() ?>,
@@ -425,11 +425,11 @@
sort_column_combobox,
sort_order_combobox
]
- },
+ },
<? if (module::is_active("tag")): ?>
{
xtype: "spacer",
- flex: 3
+ flex: 3
},
tag_textfield,
tag_button,