summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/movie.php
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2013-02-12 00:30:30 +0100
committershadlaws <shad@shadlaws.com>2013-02-12 00:30:30 +0100
commit0a2670a19ab121fe6970f2fcdf1864cb452a76c1 (patch)
tree952dd61124799af3f8f3d69dae56cdeba59dc6d3 /modules/gallery/helpers/movie.php
parente109f0b5113c1f8b33130866af44450ca4107ed4 (diff)
#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
Diffstat (limited to 'modules/gallery/helpers/movie.php')
-rw-r--r--modules/gallery/helpers/movie.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index d4b907a2..eda478c7 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -24,6 +24,8 @@
* Note: by design, this class does not do any permission checking.
*/
class movie_Core {
+ private static $allow_uploads;
+
static function get_edit_form($movie) {
$form = new Forge("movies/update/$movie->id", "", "post", array("id" => "g-edit-movie-form"));
$form->hidden("from_id")->value($movie->id);
@@ -110,6 +112,29 @@ class movie_Core {
}
/**
+ * Return true if movie uploads are allowed, false if not. This is based on the
+ * "movie_allow_uploads" Gallery variable as well as whether or not ffmpeg is found.
+ */
+ static function allow_uploads() {
+ if (empty(self::$allow_uploads)) {
+ // Refresh ffmpeg settings
+ $ffmpeg = movie::find_ffmpeg();
+ switch (module::get_var("gallery", "movie_allow_uploads", "autodetect")) {
+ case "always":
+ self::$allow_uploads = true;
+ break;
+ case "never":
+ self::$allow_uploads = false;
+ break;
+ default:
+ self::$allow_uploads = !empty($ffmpeg);
+ break;
+ }
+ }
+ return self::$allow_uploads;
+ }
+
+ /**
* Return the path to the ffmpeg binary if one exists and is executable, or null.
*/
static function find_ffmpeg() {