Commit Graph

1021 Commits

Author SHA1 Message Date
bwdutton
cdc4e97c7e Make queries work with sql_mode = 'ONLY_FULL_GROUP_BY' enabled in mysql 2018-02-25 10:14:30 -08:00
Bradley W. Dutton
bad663e05e Add dropzone js uploader as a replacement for uploadify. The latter still remains almost entirely intact. 2017-11-04 16:39:51 -07:00
shadlaws
57d12c69a8 #2083 - Sanitize data from module.info files. 2013-09-06 08:36:09 +02:00
shadlaws
d0aef95a65 Move "item_moved" event later in the item update process. Fixes #2077.
Before, this was before the children's caches were cleared, so if the
"item_moved" set an album cover, it would fail with an invalid path.  For the
same reason, we move it after the data file update, too.  Lastly, get we get
rid of duplicated code in item::move() since the "item_moved" event already
does this.
2013-07-08 09:39:54 +02:00
shadlaws
3c100d06ff #2074 - Mirror some additional file_proxy checks in data_rest. 2013-06-12 07:25:26 +02:00
shadlaws
6f922ca427 Follow-on to #2069 - Decrease stack size of MPTT rebuild task.
This reduces the likelihood that we'll hit a limit with gargantuan galleries.

--HG--
extra : source : c4a118d43145a2a4ec9b934d3aebe8f9458bcf07
2013-05-15 11:16:46 +02:00
shadlaws
2ebe38b148 #2069 - Change "Fix your Gallery" task go faster and be more comprehensive.
- optimize MPTT pointer rebuilding for leaf nodes (i.e. non-albums).
- reverse order_by to try and preserve existing tree ordering.
- reset item level while we're here.
- use "$stack[] = 123" instead of array_push($stack, 123) since it's faster.

--HG--
extra : source : 297e4c0eccc5a7940224ff8e908b366e83017354
2013-05-14 13:35:09 +02:00
shadlaws
8d0e1b4c4d #2059 - Add album name sanitizing similar to photo/movie filename sanitizing.
- added legal_file::sanitize_dirname(), analogous to sanitize_filename.
- revised item model to use new function when adding or updating an album.
- added some legal_file unit tests.
- revised some item model unit tests.
2013-03-13 10:07:58 +01:00
shadlaws
ed20798b99 #2057 - Revise item name and slug validation - backslashes, refactor, error messages.
- disallowed backslashes in item validation.
- refactored the validation logic in the item model a bit.
- added no_backslash error messages in edit album/photo/movie forms.
- fixed error messages in add album forum (some missing, some text different from edit)
- added unit tests
- updated to v58 to correct any existing backslashes in item names
2013-03-12 12:14:34 +01:00
Bharat Mediratta
0899528ff5 Merge pull request #196 from shadlaws/fix_2046
#2046 - Change Gallery over to using MediaElementJS as its movie player
2013-03-09 14:33:47 -08:00
shadlaws
de3f9edb88 Follow-on to #1935 - Ensure ffmpeg is executable, remove possible doubled "/".
- movie::find_ffmpeg - made it use is_executable instead of just file_exists.
- system::find_binary - removed possible doubled "/" in paths.
2013-03-09 15:59:23 +01:00
shadlaws
18f38f0dff #2046 - Change Gallery over to using MediaElementJS as its movie player. 2013-03-09 12:51:45 +01:00
shadlaws
4b28478776 #2040 - Deactivate modules that no longer exist.
- added module::deactivate_missing_modules()
- revised module::deactivate() to change log message if the module is missing
- added call to new function in module::get_obsolete_modules_message()
- added call to new function when loading admin/maintenance menu
2013-03-05 16:54:41 +01:00
shadlaws
e7b224461a #2034 - Add webm and ogv as valid movie types.
- added them to legal_file helper
- revised unit tests
2013-03-03 00:16:38 +01:00
shadlaws
9b9f1a7b07 #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
2013-03-02 13:25:10 +01:00
Bharat Mediratta
7c94b930ed Merge pull request #169 from shadlaws/fix_2021
#2021 - Cleanup thumb_dirty and resize_dirty instances.
2013-02-27 09:12:13 -08:00
shadlaws
891a24151e #2021 - Cleanup thumb_dirty and resize_dirty instances.
- g2_import: changed "false" assignment to "0" assignment for consistency.
- admin_theme_options: removed unused variables (they're called/used nowhere else).
- graphics: removed stanza that clears thumb_dirty and resize_dirty and returns
if we have no ops.  This has no effect on Gallery currently (for one,
graphics::generate doesn't normally get called on an item with no dirty flags),
but can inconsistently set resize_dirty of albums and movies to 0 where it's
otherwise left at 1.  Going forward, it may be useful to be consistent here.
- gallery_installer: added v57 stanza to correct any resize_dirty flags of
movies/albums that were previously reset to 0.
- module.info, install.sql: update to v57
2013-02-27 07:11:52 +01:00
shadlaws
251e9d5c8f #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.
2013-02-26 18:39:59 +01:00
shadlaws
94aadf03da #2008 - Add warnings if some active modules are obsolete.
- added module::get_obsolete_modules_message function
- put message on admin/dashboard
- put message on admin/modules
- put message on upgrader
- updated unit test golden file xss_data
2013-02-20 17:30:27 +01:00
shadlaws
fd0051dab7 #2006 - Add system::mark_file_for_delete API to delete files at shutdown.
- added system::mark_file_for_delete to be called to mark a file
- added system::delete_marked_files to be called at shutdown to delete the list
- amended system::temp_filename to, by default, add the temp name to the list
- updated a few other places in code where this should be used
2013-02-17 23:19:35 +01:00
Bharat Mediratta
96ad7789c8 Follow-on to 7bdccade98 to exclude
directories for now.
2013-02-15 19:17:34 -05:00
Bharat Mediratta
0dd12caa6f Follow-on to 7bdccade98 - point out that there's
duplicated code in gallery_event.
2013-02-15 19:12:08 -05:00
Bharat Mediratta
7bdccade98 Every 500th request prune a single old file from var/tmp and var/logs.
Might not be aggressive enough.  Fixes #2005.
2013-02-15 19:09:06 -05:00
shadlaws
f212f6a794 #2003 - Add admin/movies screen.
Added admin/movies screen analogous to the admin/graphics screen so the user can:
- see how FFmpeg is configured (path and version, similar to toolkits in admin/graphics)
- get some instructions on how to install FFmpeg if not found
- change the movie_allow_uploads setting
- ask Gallery to rebuild their movie thumbs
Specifics:
- admin_movies, admin_movies.html (new) - new Movies admin screen
- ffmpeg.png (new) - logo for admin screen
- movie::get_ffmpeg_version (new) - return version number and date of FFmpeg
- form_uploadify.html - change admin message if movie uploads are disabled
- gallery_event::admin_menu - added Movies link to Settings
- xss_data.txt - updated golden file for unit tests
2013-02-14 23:42:20 +01:00
Bharat Mediratta
6c861a014d Merge pull request #133 from shadlaws/followon_1994
Follow-on to 0312d1b071 for #1994.
2013-02-14 11:18:45 -08:00
Bharat Mediratta
8a1133952e Merge pull request #134 from shadlaws/fix_2001
#2001 - Make filename sanitizing more consistent.
2013-02-12 09:24:37 -08:00
shadlaws
d04a6fc87d #2001 - Make filename sanitizing more consistent.
- legal_file - added sanitize_filname() to sanitize photo/movie filenames.
- admin_watermarks - revised add() to use new function.
- item model - added _process_data_file_info() to validate the data file, get its metadata, and sanitize the item name.
- item model - revised save() for new items to use _process_data_file_info *before* the slug is checked.
- item model - revised save() for updated items to use _process_data_file_info.
- item model - revised save() for updated items to sanitize name if changed.
- uploader - removed call to smash_extensions (item model does this when it calls sanitize_filename).
- Legal_File_Helper_Test - added unit tests for sanitize_filename.
- Item_Model_Test - revised existing unit tests based on changes.
- Item_Model_Test - added new unit tests for names with legal but incorrect extensions.
- Averted take over by HAL with fix #2001...
2013-02-12 00:37:33 +01:00
shadlaws
0a2670a19a #1988 - Add movie_allow_uploads option ("always", "never", or "autodetect").
- gallery_installer, module.info, install.sql - add movie_allow_uploads variable
- movie::allow_uploads (new) - return true if movie_allow_uploads is "always" or "autodetect" and FFmpeg found, false otherwise
- legal_file - use movie::allow_uploads instead of movie::find_ffmpeg
- Form_Uploadify - use movie::allow_uploads instead of movie::find_ffmpeg
2013-02-12 00:30:30 +01:00
Bharat Mediratta
33149ef87a Merge pull request #121 from shadlaws/fix_1935_only
#1935 - Make FFmpeg easier to install.
2013-02-10 21:51:05 -08:00
shadlaws
27be4ae606 Follow-on to 0312d1b071 for #1994.
- Updated function comments to match revisions.
- No functional changes.
2013-02-10 10:10:44 +01:00
shadlaws
bfdf5a00fd #2000 - Make legal_file::smash_extensions more robust.
- Fixed legal_file::smash_extensions.
- Added new unit test.
- Removed duplicated condition in existing unit test.
2013-02-10 02:28:47 +01:00
shadlaws
1d7f5e3ab1 #1935 - Make FFmpeg easier to install.
- system::find_binary - add Gallery's bin subdirectory to search
- system::find_binary - auto-fix permissions if found in Gallery's bin directory
2013-02-09 20:48:02 +01:00
Bharat Mediratta
11e56b29da Merge pull request #130 from shadlaws/fix_1997
#1997 - Correct movie dimensions and mime type improperly set by contributed modules.
2013-02-09 10:36:42 -08:00
Bharat Mediratta
2dc695c606 Merge pull request #129 from shadlaws/fix_1996
#1996 - Add blacklist to legal_file helper.
2013-02-09 10:36:03 -08:00
shadlaws
8dcdb3b8e1 #1997 - Update movie dimensions and mime type if previously set without FFmpeg.
- Added code to check/correct movie width, height, and mime in graphics::generate.
As the comment says in the commit, this isn't ideal, but doing it in an upgrade
script wouldn't be very ideal either.
2013-02-09 18:12:08 +01:00
shadlaws
942233dd26 #1996 - Add blacklist to legal_file helper.
Adding a blacklist to legal_file could prevent possible security holes arising
from a contributed module that adds file types by user input (e.g. an admin screen).
2013-02-08 15:21:57 +01:00
shadlaws
0312d1b071 #1994 - Make get_file_metadata throw an exception if photo or movie is unidentifiable/illegal.
- photo & movie helpers: modified to throw exceptions when file is known to be unidentifiable/illegal.
- item model: revised to work with exceptions and be more explicit when the data file is invalid.
- item model: removed duplicate get_file_metadata call for updated items.
- admin_watermarks controller: revised to work with exceptions (really cleans up logic here).
- graphics helper: revised to handle invalid placeholders (a nearly-impossible corner case, but still...).
- photo & movie helper tests: revised to work with exceptions, added new tests for illegal files with valid extensions.
- item model tests: revised to work with exceptions, added new tests for illegal files with valid extensions.
2013-02-08 13:51:41 +01:00
shadlaws
faa719551d #1991 - Add options to graphics::mark_dirty to specify type and/or mime type.
- graphics::mark_dirty - added $type and $mime_type as options.
- graphics::mark_dirty - used options to set additional where conditions.
2013-02-06 11:04:24 +01:00
Bharat Mediratta
dece6dc5a5 Create gallery::allow_css_and_js_combining() which lets you disable combining CSS/JS
by touching var/DONT_COMBINE.  Fixes #1989.
2013-02-02 23:39:16 -05:00
Bharat Mediratta
9396342250 Drop the requirement to have the install() function set the module
version.  It's redundant.  Fixes #1985.
2013-01-31 19:55:53 -05:00
shadlaws
f83ed5f871 #1982 - Add placeholder for albums with no album cover.
- Added missing_album_cover.jpg placeholder image.
- Modified the graphics helper to use it.  Calling graphics::generate will copy it.
- Modified item::remove_album_cover and gallery_event::item_created to run graphics::generate.
- Added unit test to Graphics_Helper_Test.
2013-01-31 17:18:39 +01:00
Bharat Mediratta
8d15e5cb2e Follow-in to cff1e76e8d for #1978
Restrict which album cover ids we swap over to the hierarchy of the
current album, otherwise we can wind up in sticky situations with
hierarchical album cover chains.

Eg, you have a hierarchy like this:

root -> A1 -> A2 --> A3 -> P1
                     A4 -> P2

P1 is the album cover for its entire hierarchy.  But then you
swap A2's album cover for A3 making this:

root -> A1 -> A2 +   A3 -> P1
                 \-> A4 -> P2

Since A1, A2 and A3 all had P1 as their album cover item id.  Now
we're swapping it over to P2 but we want to leave P1 as A3's album
cover item id.  So only look at A4's hierarchy and ignore its peers.
2013-01-30 21:42:47 -05:00
Bharat Mediratta
075b95f0ed Actually disable the "make album cover" option when the item is already the album cover. Fixes #1979. 2013-01-30 21:18:26 -05:00
Bharat Mediratta
cff1e76e8d When changing the album cover, find and retarget any other albums which were using the old item as their album cover. Fixes #1978. 2013-01-30 21:08:36 -05:00
shadlaws
cf07742595 #1968 - Improve album cover generation/removal/etc.
- Added stanza to Item_Model::save that handles when cover id is null.
- Added logic to graphics::generate to copy/convert album cover thumbs from their item thumbs to ensure they're always jpg, and eliminate the possibility that we copy/convert a dirty thumb.
- Redirected other places in code where we want to do one of the above two things to use these two functions instead (gallery_event::item_updated_data_file, item::make_album_cover, item::remove_album_cover).
- Improved validation in Item_Model so only albums can have covers and all covers must be non-albums.
- Added unit tests to Graphics_Helper_Test.
2013-01-30 01:07:36 +01:00
shadlaws
536bdaa4db #1967 - Improve how graphics::generate handles missing/bad images.
- Made missing_photo match the image format (jpg, png, etc.).
- Swapped missing_photo.png for missing_photo.jpg since it's likely to require less conversion to match.
- Improved error messages to user when things go wrong.
- Ensured that missing image placeholders are always copied when there's an error.
- Ensured we don't mistake no file output for a correct file output (delete target before attempt).
- Restructured graphics::generate a bit to work better with above changes.
- Added unit tests for graphics::generate.
2013-01-29 18:35:10 +01:00
Bharat Mediratta
2551b31b8f Merge pull request #106 from shadlaws/fix_1945
#1945 - Extend legal_file helper functions.
2013-01-29 09:10:06 -08:00
Bharat Mediratta
3b0de7791b Merge pull request #107 from shadlaws/fix_1969
#1969 - Give graphics events the ability to override the standard process
2013-01-29 09:01:31 -08:00
shadlaws
5fca371a61 #1945 - Extend legal_file helper functions.
- Added get_types_by_extension function, which is a merged version of get...types_by_extension functions (similar to get_extensions).
- Added optional extension argument to get...extensions functions similar to get...types_by_extension functions.
- Added unit tests.  Now, every legal_file function has one.
- Restructured helper file to include caches.
- Added array_unique to get...types (derived from get...types_by_extension, which can be many-to-one).
- Edited server_add, uploader, and item model to use new functionality.
2013-01-28 23:31:18 +01:00
shadlaws
9e20a30d22 #1969 - Give graphics events the ability to override the standard process.
While graphics_rotate, graphics_resize, and graphics_composite events already exist, they don't have the ability to *override* the standard process.
This makes it a bit tricky when you want to replace the standard procedure with another (e.g. use jpegtran to perform lossless jpg rotation).
Solution:
- make a temp filename.
- tell the events to use it as the output file.
- if an event makes something, use it and skip the standard process.
2013-01-27 21:55:24 +01:00