Merge branch 'master' of github.com:chadparry/gallery3-contrib into rawphoto
This commit is contained in:
commit
1080f65d67
|
@ -38,7 +38,7 @@
|
|||
// Check and see if any photos were taken in January,
|
||||
// If so, make the month title into a clickable link.
|
||||
print "<div id=\"g-calendar-grid\">";
|
||||
if (date("n", $items_for_year[$counter]->captured) == 1) {
|
||||
if ((count($items_for_year) > 0) && (date("n", $items_for_year[$counter]->captured) == 1)) {
|
||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||
} else {
|
||||
$month_url = "";
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-captionator-dialog">
|
||||
<script type="text/javascript">
|
||||
$('form input[name^=tags]').ready(function() {
|
||||
$('form input[name^=tags]').autocomplete(
|
||||
'/tags/autocomplete', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1});
|
||||
$(document).ready(function() {
|
||||
$('form input[name^=tags]').ready(function() {
|
||||
$('form input[name^=tags]').autocomplete(
|
||||
"<?= url::site("/tags/autocomplete") ?>",
|
||||
{max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1});
|
||||
});
|
||||
$('form input[name^=title]').change(function() {
|
||||
var title = $(this).val();
|
||||
slug = slug.replace(/^\'/, "");
|
||||
var slug = title.replace(/[^A-Za-z0-9-_]+/g, "-");
|
||||
slug = slug.replace(/^-/, "");
|
||||
slug = slug.replace(/-$/, "");
|
||||
$(this).parent().parent().find("input[name^=internetaddress]").val(slug);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<form action="<?= url::site("captionator/save/{$album->id}") ?>" method="post" id="g-captionator-form">
|
||||
|
@ -23,7 +34,7 @@
|
|||
<ul>
|
||||
<li>
|
||||
<label for="title[<?= $child->id ?>]"> <?= t("Title") ?> </label>
|
||||
<input type="text" name="title[<?= $child->id ?>]" value="<?= $child->title ?>"/>
|
||||
<input type="text" name="title[<?= $child->id ?>]" value="<?= html::chars($child->title) ?>"/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="description[<?= $child->id ?>]"> <?= t("Description") ?> </label>
|
||||
|
@ -32,16 +43,16 @@
|
|||
<? if ($enable_tags): ?>
|
||||
<li>
|
||||
<label for="tags[<?= $child->id ?>]"> <?= t("Tags (comma separated)") ?> </label>
|
||||
<input type="text" name="tags[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= $tags[$child->id] ?>"/>
|
||||
<input type="text" name="tags[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($tags[$child->id]) ?>"/>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<li>
|
||||
<label for="filename[<?= $child->id ?>]"> <?= t("Filename") ?> </label>
|
||||
<input type="text" name="filename[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= $child->name ?>"/>
|
||||
<input type="text" name="filename[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($child->name) ?>"/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="internetaddress[<?= $child->id ?>]"> <?= t("Internet Address") ?> </label>
|
||||
<input type="text" name="internetaddress[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= $child->slug ?>"/>
|
||||
<input type="text" name="internetaddress[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($child->slug) ?>"/>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
|
||||
// rWatcher edit: include MP4Info.php library.
|
||||
include MODPATH . "noffmpeg/libraries/MP4Info.php";
|
||||
|
||||
class movie_Core {
|
||||
|
@ -61,7 +62,7 @@ class movie_Core {
|
|||
}
|
||||
|
||||
static function extract_frame($input_file, $output_file) {
|
||||
$ffmpeg = self::find_ffmpeg();
|
||||
$ffmpeg = movie::find_ffmpeg();
|
||||
if (empty($ffmpeg)) {
|
||||
// BEGIN rWatcher Edit.
|
||||
copy(MODPATH . "noffmpeg/images/missing_movie.png", $output_file);
|
||||
|
@ -89,27 +90,23 @@ class movie_Core {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the path to the ffmpeg binary if one exists and is executable, or null.
|
||||
*/
|
||||
static function find_ffmpeg() {
|
||||
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
|
||||
$graphics_path = module::get_var("gallery", "graphics_toolkit_path", null);
|
||||
|
||||
putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") .
|
||||
":/usr/local/bin:/opt/local/bin:/opt/bin");
|
||||
if (function_exists("exec")) {
|
||||
$ffmpeg_path = exec("which ffmpeg");
|
||||
}
|
||||
|
||||
$ffmpeg_path = system::find_binary(
|
||||
"ffmpeg", module::get_var("gallery", "graphics_toolkit_path"));
|
||||
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
|
||||
}
|
||||
return $ffmpeg_path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the width, height, mime_type and extension of the given movie file.
|
||||
*/
|
||||
static function get_file_metadata($file_path) {
|
||||
$ffmpeg = self::find_ffmpeg();
|
||||
$ffmpeg = movie::find_ffmpeg();
|
||||
if (empty($ffmpeg)) {
|
||||
// BEGIN rWatcher Edit.
|
||||
$pi = pathinfo($file_path);
|
||||
|
@ -147,4 +144,4 @@ class movie_Core {
|
|||
return array($width, $height, $mime_type, $extension);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
164
3.0/modules/noffmpeg/views/form_uploadify.html.php
Normal file
164
3.0/modules/noffmpeg/views/form_uploadify.html.php
Normal file
|
@ -0,0 +1,164 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script>
|
||||
<script type="text/javascript">
|
||||
<? $flash_minimum_version = "9.0.24" ?>
|
||||
<? $movies_allowed = true; // rWatcher EDIT ?>
|
||||
var success_count = 0;
|
||||
var error_count = 0;
|
||||
var updating = 0;
|
||||
$("#g-add-photos-canvas").ready(function () {
|
||||
var update_status = function() {
|
||||
if (updating) {
|
||||
// poor man's mutex
|
||||
setTimeout(function() { update_status(); }, 500);
|
||||
}
|
||||
updating = 1;
|
||||
$.get("<?= url::site("uploader/status/_S/_E") ?>"
|
||||
.replace("_S", success_count).replace("_E", error_count),
|
||||
function(data) {
|
||||
$("#g-add-photos-status-message").html(data);
|
||||
updating = 0;
|
||||
});
|
||||
};
|
||||
|
||||
if (swfobject.hasFlashPlayerVersion("<?= $flash_minimum_version ?>")) {
|
||||
$("#g-uploadify").uploadify({
|
||||
width: 150,
|
||||
height: 33,
|
||||
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
|
||||
script: "<?= url::site("uploader/add_photo/{$album->id}") ?>",
|
||||
scriptData: <?= json_encode($script_data) ?>,
|
||||
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.GIF;*.JPG;*.JPEG;*.PNG<? if ($movies_allowed): ?>;*.flv;*.mp4;*.m4v;*.FLV;*.MP4;*.M4V<? endif ?>",
|
||||
fileDesc: <?= t("Photos and movies")->for_js() ?>,
|
||||
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
|
||||
simUploadLimit: <?= $simultaneous_upload_limit ?>,
|
||||
wmode: "transparent",
|
||||
hideButton: true, /* should be true */
|
||||
auto: true,
|
||||
multi: true,
|
||||
onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) {
|
||||
$("#g-upload-cancel-all")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
$("#g-upload-done")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
return true;
|
||||
},
|
||||
onClearQueue: function(event) {
|
||||
$("#g-upload-cancel-all")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
$("#g-upload-done")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
return true;
|
||||
},
|
||||
onComplete: function(event, queueID, fileObj, response, data) {
|
||||
var re = /^error: (.*)$/i;
|
||||
var msg = re.exec(response);
|
||||
$("#g-add-photos-status ul").append(
|
||||
"<li id=\"q" + queueID + "\" class=\"g-success\">" + fileObj.name + " - " +
|
||||
<?= t("Completed")->for_js() ?> + "</li>");
|
||||
setTimeout(function() { $("#q" + queueID).slideUp("slow").remove() }, 5000);
|
||||
success_count++;
|
||||
update_status();
|
||||
return true;
|
||||
},
|
||||
onError: function(event, queueID, fileObj, errorObj) {
|
||||
var msg = " - ";
|
||||
if (errorObj.type == "HTTP") {
|
||||
if (errorObj.info == "500") {
|
||||
msg += <?= t("Unable to process this file")->for_js() ?>;
|
||||
// Server error - check server logs
|
||||
} else if (errorObj.info == "404") {
|
||||
msg += <?= t("The upload script was not found.")->for_js() ?>;
|
||||
// Server script not found
|
||||
} else {
|
||||
// Server Error: status: errorObj.info
|
||||
msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info));
|
||||
}
|
||||
} else if (errorObj.type == "File Size") {
|
||||
var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit);
|
||||
msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB';
|
||||
} else {
|
||||
msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
|
||||
.replace("__INFO__", errorObj.info)
|
||||
.replace("__TYPE__", errorObj.type));
|
||||
}
|
||||
$("#g-add-photos-status ul").append(
|
||||
"<li id=\"q" + queueID + "\" class=\"g-error\">" + fileObj.name + msg + "</li>");
|
||||
$("#g-uploadify").uploadifyCancel(queueID);
|
||||
error_count++;
|
||||
update_status();
|
||||
},
|
||||
onSelect: function(event) {
|
||||
if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) {
|
||||
$("#g-upload-cancel-all")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
$("#g-upload-done")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(".requires-flash").hide();
|
||||
$(".no-flash").show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="requires-flash">
|
||||
<? if ($suhosin_session_encrypt || (identity::active_user()->admin && !$movies_allowed)): ?>
|
||||
<div class="g-message-block g-info">
|
||||
<? if ($suhosin_session_encrypt): ?>
|
||||
<p class="g-error">
|
||||
<?= t("Error: your server is configured to use the <a href=\"%encrypt_url\"><code>suhosin.session.encrypt</code></a> setting from <a href=\"%suhosin_url\">Suhosin</a>. You must disable this setting to upload photos.",
|
||||
array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt",
|
||||
"suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
|
||||
<? if (identity::active_user()->admin && !$movies_allowed): ?>
|
||||
<p class="g-warning">
|
||||
<?= t("Can't find <i>ffmpeg</i> on your system. Movie uploading disabled. <a href=\"%help_url\">Help!</a>", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<div>
|
||||
<p>
|
||||
<?= t("Photos will be uploaded to album: ") ?>
|
||||
</p>
|
||||
<ul class="g-breadcrumbs ui-helper-clearfix">
|
||||
<? foreach ($album->parents() as $i => $parent): ?>
|
||||
<li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li>
|
||||
<? endforeach ?>
|
||||
<li class="g-active"> <?= html::purify($album->title) ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="g-add-photos-canvas">
|
||||
<button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button>
|
||||
<span id="g-uploadify"></span>
|
||||
</div>
|
||||
<div id="g-add-photos-status">
|
||||
<ul id="g-action-status" class="g-message-block">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="no-flash" style="display: none">
|
||||
<p>
|
||||
<?= t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version)) ?>
|
||||
</p>
|
||||
<a href="http://www.adobe.com/go/getflashplayer">
|
||||
<img src="<?= request::protocol() ?>://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
|
||||
alt=<?= t("Get Adobe Flash Player")->for_js() ?> />
|
||||
</a>
|
||||
</div>
|
|
@ -19,7 +19,15 @@
|
|||
*/
|
||||
class tagsinalbum_installer {
|
||||
static function install() {
|
||||
module::set_version("tagsinalbum", 1);
|
||||
module::set_var("tagsinalbum", "max_display_tags", 0);
|
||||
module::set_version("tagsinalbum", 2);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
if ($version == 1) {
|
||||
module::set_var("tagsinalbum", "max_display_tags", 0);
|
||||
module::set_version("tagsinalbum", $version = 2);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = "Tags In Album"
|
||||
description = "Creates a sidebar block to display tags used by photos and videos in the current album."
|
||||
version = 1
|
||||
version = 2
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
$display_tags[] = array(html::clean($tag->name), $tag->url());
|
||||
$last_tagid = $one_tag->id;
|
||||
}
|
||||
if (module::get_var("tagsinalbum", "max_display_tags") > 0) {
|
||||
if (count($display_tags) == module::get_var("tagsinalbum", "max_display_tags")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the array.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,10 +17,14 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher EDIT: This file used to be admin_server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
|
||||
class Admin_Videos_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Add videos from server");
|
||||
$view->page_title = t("Add from server");
|
||||
$view->content = new View("admin_videos.html");
|
||||
$view->content->form = $this->_get_admin_form();
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}"));
|
||||
|
|
144
3.0/modules/videos/controllers/file_proxy.php
Normal file
144
3.0/modules/videos/controllers/file_proxy.php
Normal file
|
@ -0,0 +1,144 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* Proxy access to files in var/albums and var/resizes, making sure that the session user has
|
||||
* access to view these files.
|
||||
*
|
||||
* Security Philosophy: we do not use the information provided to find if the file exists on
|
||||
* disk. We use this information only to locate the correct item in the database and then we
|
||||
* *only* use information from the database to find and proxy the correct file. This way all user
|
||||
* input is sanitized against the database before we perform any file I/O.
|
||||
*/
|
||||
class File_Proxy_Controller extends Controller {
|
||||
const ALLOW_PRIVATE_GALLERY = true;
|
||||
public function __call($function, $args) {
|
||||
// request_uri: gallery3/var/albums/foo/bar.jpg?m=1234
|
||||
$request_uri = rawurldecode(Input::instance()->server("REQUEST_URI"));
|
||||
|
||||
// get rid of query parameters
|
||||
// request_uri: gallery3/var/albums/foo/bar.jpg
|
||||
$request_uri = preg_replace("/\?.*/", "", $request_uri);
|
||||
|
||||
// var_uri: gallery3/var/
|
||||
$var_uri = url::file("var/");
|
||||
|
||||
// Make sure that the request is for a file inside var
|
||||
$offset = strpos(rawurldecode($request_uri), $var_uri);
|
||||
if ($offset !== 0) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// file_uri: albums/foo/bar.jpg
|
||||
$file_uri = substr($request_uri, strlen($var_uri));
|
||||
|
||||
// type: albums
|
||||
// path: foo/bar.jpg
|
||||
list ($type, $path) = explode("/", $file_uri, 2);
|
||||
if ($type != "resizes" && $type != "albums" && $type != "thumbs") {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// 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 .flv, .mp4 or .m4v file would
|
||||
// have been converted to a .jpg. So try some alternate types:
|
||||
if (preg_match('/.jpg$/', $path)) {
|
||||
// rWatcher Mod: look for videos with file extensions supported by the videos module in addition to flv mp4 and m4v
|
||||
// Original Line: foreach (array("flv", "mp4", "m4v") as $ext) {
|
||||
foreach (array_merge(array("flv", "mp4", "m4v"), unserialize(module::get_var("videos", "allowed_extensions"))) as $ext) {
|
||||
$movie_path = preg_replace('/.jpg$/', ".$ext", $path);
|
||||
$item = item::find_by_path($movie_path);
|
||||
if ($item->loaded()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// rWatcher Mod:
|
||||
// If we're looking for a .flv then it's it's possible that we're requesting a flash resize
|
||||
// for a movie.
|
||||
if (strtolower(substr($path, strlen($path)-4)) == ".flv") {
|
||||
$movie_path = str_ireplace(".flv", "", $path);
|
||||
$item = ORM::factory("item")->where("relative_path_cache", "=", $movie_path)->find();
|
||||
}
|
||||
// END rWatcher Mod
|
||||
}
|
||||
|
||||
if (!$item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Make sure we have access to the item
|
||||
if (!access::can("view", $item)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Make sure we have view_full access to the original
|
||||
if ($type == "albums" && !access::can("view_full", $item)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Don't try to load a directory
|
||||
if ($type == "albums" && $item->is_album()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
if ($type == "albums") {
|
||||
$file = $item->file_path();
|
||||
} else if ($type == "resizes") {
|
||||
$file = $item->resize_path();
|
||||
// rWatcher MOD
|
||||
// If the resize is for a movie, assume it needs a .flv extension.
|
||||
if ($item->is_movie()) {
|
||||
$file = $file . ".flv";
|
||||
}
|
||||
// End rWatcher MOD
|
||||
} else {
|
||||
$file = $item->thumb_path();
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
header("Content-Length: " . filesize($file));
|
||||
|
||||
header("Pragma:");
|
||||
// Check that the content hasn't expired or it wasn't changed since cached
|
||||
expires::check(2592000, $item->updated);
|
||||
|
||||
// We don't need to save the session for this request
|
||||
Session::instance()->abort_save();
|
||||
|
||||
expires::set(2592000, $item->updated); // 30 days
|
||||
|
||||
// Dump out the image. If the item is a movie, then its thumbnail will be a JPG.
|
||||
if ($item->is_movie() && $type != "albums") {
|
||||
header("Content-Type: image/jpeg");
|
||||
} else {
|
||||
header("Content-Type: $item->mime_type");
|
||||
}
|
||||
Kohana::close_buffers(false);
|
||||
readfile($file);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additional editing has also been done in three places to expand accepted file
|
||||
// extensions and to create resizes and an extra db entry for items_videos.
|
||||
|
||||
class Videos_Controller extends Admin_Controller {
|
||||
public function browse($id) {
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||
|
@ -24,6 +30,12 @@ class Videos_Controller extends Admin_Controller {
|
|||
$files[] = $path;
|
||||
}
|
||||
|
||||
// Clean leftover task rows. There really should be support for this in the task framework
|
||||
db::build()
|
||||
->where("task_id", "NOT IN", db::build()->select("id")->from("tasks"))
|
||||
->delete("videos_entries")
|
||||
->execute();
|
||||
|
||||
$item = ORM::factory("item", $id);
|
||||
$view = new View("videos_tree_dialog.html");
|
||||
$view->item = $item;
|
||||
|
@ -55,6 +67,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
if (!is_dir($file)) {
|
||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
// rWatcher Edit
|
||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
continue;
|
||||
|
@ -74,23 +87,28 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Begin the task of adding files.
|
||||
* Begin the task of adding photos.
|
||||
*/
|
||||
public function start() {
|
||||
access::verify_csrf();
|
||||
$item = ORM::factory("item", Input::instance()->get("item_id"));
|
||||
|
||||
foreach (Input::instance()->post("paths") as $path) {
|
||||
if (videos::is_valid_path($path)) {
|
||||
$paths[] = array($path, null);
|
||||
}
|
||||
}
|
||||
|
||||
$task_def = Task_Definition::factory()
|
||||
->callback("Videos_Controller::add")
|
||||
->description(t("Add videos from the local server"))
|
||||
->description(t("Add photos or movies from the local server"))
|
||||
->name(t("Add from server"));
|
||||
$task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths));
|
||||
$task = task::create($task_def, array("item_id" => $item->id));
|
||||
|
||||
foreach (Input::instance()->post("paths") as $path) {
|
||||
if (videos::is_valid_path($path)) {
|
||||
$entry = ORM::factory("videos_entry");
|
||||
$entry->path = $path;
|
||||
$entry->is_directory = intval(is_dir($path));
|
||||
$entry->parent_id = null;
|
||||
$entry->task_id = $task->id;
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
|
||||
json::reply(
|
||||
array("result" => "started",
|
||||
|
@ -99,7 +117,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Run the task of adding files
|
||||
* Run the task of adding photos
|
||||
*/
|
||||
function run($task_id) {
|
||||
access::verify_csrf();
|
||||
|
@ -119,7 +137,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
|
||||
/**
|
||||
* This is the task code that adds photos and albums. It first examines all the target files
|
||||
* and creates a set of Server_Add_File_Models, then runs through the list of models and adds
|
||||
* and creates a set of Server_Add_Entry_Models, then runs through the list of models and adds
|
||||
* them one at a time.
|
||||
*/
|
||||
static function add($task) {
|
||||
|
@ -129,6 +147,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
switch ($mode) {
|
||||
case "init":
|
||||
$task->set("mode", "build-file-list");
|
||||
$task->set("dirs_scanned", 0);
|
||||
$task->percent_complete = 0;
|
||||
$task->status = t("Starting up");
|
||||
batch::start();
|
||||
|
@ -137,59 +156,64 @@ class Videos_Controller extends Admin_Controller {
|
|||
case "build-file-list": // 0% to 10%
|
||||
// We can't fit an arbitrary number of paths in a task, so store them in a separate table.
|
||||
// Don't use an iterator here because we can't get enough control over it when we're dealing
|
||||
// with a deep hierarchy and we don't want to go over our time quota. The queue is in the
|
||||
// form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We
|
||||
// have this extra level of abstraction because we don't know its Item_Model id yet.
|
||||
$queue = $task->get("queue");
|
||||
// with a deep hierarchy and we don't want to go over our time quota.
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||
$dirs_scanned = $task->get("dirs_scanned");
|
||||
while (microtime(true) - $start < 0.5) {
|
||||
// Process every directory that doesn't yet have a parent id, these are the
|
||||
// paths that we're importing.
|
||||
$entry = ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->where("is_directory", "=", 1)
|
||||
->where("checked", "=", 0)
|
||||
->order_by("id", "ASC")
|
||||
->find();
|
||||
|
||||
while ($queue && microtime(true) - $start < 0.5) {
|
||||
list($file, $parent_entry_id) = array_shift($queue);
|
||||
// Ignore the staging directories as directories to be imported.
|
||||
if (empty($paths[$file])) {
|
||||
$entry = ORM::factory("videos_file");
|
||||
$entry->task_id = $task->id;
|
||||
$entry->file = $file;
|
||||
$entry->parent_id = $parent_entry_id;
|
||||
$entry->save();
|
||||
$entry_id = $entry->id;
|
||||
} else {
|
||||
$entry_id = null;
|
||||
}
|
||||
|
||||
$file = preg_quote($file);
|
||||
foreach (glob("$file/*") as $child) {
|
||||
if (is_dir($child)) {
|
||||
$queue[] = array($child, $entry_id);
|
||||
} else {
|
||||
$ext = strtolower(pathinfo($child, PATHINFO_EXTENSION));
|
||||
//if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) &&
|
||||
if (in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) &&
|
||||
filesize($child) > 0) {
|
||||
$child_entry = ORM::factory("videos_file");
|
||||
$child_entry->task_id = $task->id;
|
||||
$child_entry->file = $child;
|
||||
$child_entry->parent_id = $entry_id;
|
||||
$child_entry->save();
|
||||
}
|
||||
if ($entry->loaded()) {
|
||||
$child_paths = glob(preg_quote($entry->path) . "/*");
|
||||
if (!$child_paths) {
|
||||
$child_paths = glob("{$entry->path}/*");
|
||||
}
|
||||
foreach ($child_paths as $child_path) {
|
||||
if (!is_dir($child_path)) {
|
||||
$ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION));
|
||||
// rWatcher Edit.
|
||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) ||
|
||||
// !filesize($child_path)) {
|
||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) ||
|
||||
!filesize($child_path)) {
|
||||
// Not importable, skip it.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$child_entry = ORM::factory("videos_entry");
|
||||
$child_entry->task_id = $task->id;
|
||||
$child_entry->path = $child_path;
|
||||
$child_entry->parent_id = $entry->id; // null if the parent was a staging dir
|
||||
$child_entry->is_directory = is_dir($child_path);
|
||||
$child_entry->save();
|
||||
}
|
||||
|
||||
// We've processed this entry, mark it as done.
|
||||
$entry->checked = 1;
|
||||
$entry->save();
|
||||
$dirs_scanned++;
|
||||
}
|
||||
}
|
||||
|
||||
// We have no idea how long this can take because we have no idea how deep the tree
|
||||
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
|
||||
// over 10% in percent_complete.
|
||||
$task->set("queue", $queue);
|
||||
$task->set("dirs_scanned", $dirs_scanned);
|
||||
$task->percent_complete = min($task->percent_complete + 0.1, 10);
|
||||
$task->status = t2(
|
||||
"Found one file", "Found %count files",
|
||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
||||
$task->status = t2("Scanned one directory", "Scanned %count directories", $dirs_scanned);
|
||||
|
||||
if (!$queue) {
|
||||
if (!$entry->loaded()) {
|
||||
$task->set("mode", "add-files");
|
||||
$task->set(
|
||||
"total_files",
|
||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
||||
ORM::factory("videos_entry")->where("task_id", "=", $task->id)->count_all());
|
||||
$task->percent_complete = 10;
|
||||
}
|
||||
break;
|
||||
|
@ -201,7 +225,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
// Ordering by id ensures that we add them in the order that we created the entries, which
|
||||
// will create albums first. Ignore entries which already have an Item_Model attached,
|
||||
// they're done.
|
||||
$entries = ORM::factory("videos_file")
|
||||
$entries = ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->where("item_id", "IS", null)
|
||||
->order_by("id", "ASC")
|
||||
|
@ -220,43 +244,59 @@ class Videos_Controller extends Admin_Controller {
|
|||
|
||||
// Look up the parent item for this entry. By now it should exist, but if none was
|
||||
// specified, then this belongs as a child of the current item.
|
||||
$parent_entry = ORM::factory("videos_file", $entry->parent_id);
|
||||
$parent_entry = ORM::factory("videos_entry", $entry->parent_id);
|
||||
if (!$parent_entry->loaded()) {
|
||||
$parent = ORM::factory("item", $task->get("item_id"));
|
||||
} else {
|
||||
$parent = ORM::factory("item", $parent_entry->item_id);
|
||||
}
|
||||
|
||||
$name = basename($entry->file);
|
||||
$name = basename($entry->path);
|
||||
$title = item::convert_filename_to_title($name);
|
||||
if (is_dir($entry->file)) {
|
||||
if ($entry->is_directory) {
|
||||
$album = ORM::factory("item");
|
||||
$album->type = "album";
|
||||
$album->parent_id = $parent->id;
|
||||
$album->name = $name;
|
||||
$album->title = $title;
|
||||
$album->owner_id = $owner_id;
|
||||
$album->sort_order = $parent->sort_order;
|
||||
$album->sort_column = $parent->sort_column;
|
||||
$album->save();
|
||||
$entry->item_id = $album->id;
|
||||
} else {
|
||||
try {
|
||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
||||
if (in_array($extension, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) {
|
||||
$photo = ORM::factory("item");
|
||||
$photo->type = "photo";
|
||||
$photo->parent_id = $parent->id;
|
||||
$photo->set_data_file($entry->path);
|
||||
$photo->name = $name;
|
||||
$photo->title = $title;
|
||||
$photo->owner_id = $owner_id;
|
||||
$photo->save();
|
||||
$entry->item_id = $photo->id;
|
||||
// rWatcher EDIT
|
||||
//} else if (in_array($extension, array("flv", "mp4", "m4v"))) {
|
||||
} else if (in_array($extension, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
$movie = ORM::factory("item");
|
||||
$movie->type = "movie";
|
||||
$movie->parent_id = $parent->id;
|
||||
$movie->set_data_file($entry->file);
|
||||
$movie->set_data_file($entry->path);
|
||||
$movie->name = $name;
|
||||
$movie->title = $title;
|
||||
$movie->owner_id = $owner_id;
|
||||
$movie->save();
|
||||
$entry->item_id = $movie->id;
|
||||
// rWatcher EDIT: Add record to items_video db.
|
||||
$items_video = ORM::factory("items_video");
|
||||
$items_video->item_id = $movie->id;
|
||||
$items_video->save();
|
||||
if (file_exists($entry->file . ".flv")) {
|
||||
copy($entry->file . ".flv", $movie->resize_path() . ".flv");
|
||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->file . ".flv");
|
||||
// rWatcher EDIT: Scan for flv resizes and copy to resize directory.
|
||||
if (file_exists($entry->path . ".flv")) {
|
||||
copy($entry->path . ".flv", $movie->resize_path() . ".flv");
|
||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->path . ".flv");
|
||||
$movie->height = $vid_height;
|
||||
$movie->width = $vid_width;
|
||||
$movie->save();
|
||||
|
@ -266,12 +306,12 @@ class Videos_Controller extends Admin_Controller {
|
|||
// process. But just in, case.. set this to a non-null value so that we skip this
|
||||
// entry.
|
||||
$entry->item_id = 0;
|
||||
$task->log("Skipping unknown file type: $entry->file");
|
||||
$task->log("Skipping unknown file type: {$entry->path}");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
||||
$entry->item_id = 0;
|
||||
$task->log("Skipping invalid file: $entry->file");
|
||||
$task->log("Skipping invalid file: {$entry->file}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,12 +330,11 @@ class Videos_Controller extends Admin_Controller {
|
|||
$task->done = true;
|
||||
$task->state = "success";
|
||||
$task->percent_complete = 100;
|
||||
db::build()
|
||||
->delete("videos_files")
|
||||
ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->execute();
|
||||
message::info(t2("Successfully added one file",
|
||||
"Successfully added %count files",
|
||||
->delete_all();
|
||||
message::info(t2("Successfully added one photo / album",
|
||||
"Successfully added %count photos / albums",
|
||||
$task->get("completed_files")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
#g-server-add button {
|
||||
#g-videos button {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
#g-server-add-tree {
|
||||
#g-videos-tree {
|
||||
cursor: pointer;
|
||||
padding-left: 4px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
#g-server-add-tree li {
|
||||
#g-videos-tree li {
|
||||
padding: 0;
|
||||
float: none;
|
||||
}
|
||||
|
||||
#g-server-add-tree span.selected {
|
||||
#g-videos-tree span.selected {
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
#g-server-add-tree {
|
||||
#g-videos-tree {
|
||||
border: 1px solid #ccc;
|
||||
height: 20em;
|
||||
overflow: auto;
|
||||
|
@ -25,14 +25,14 @@
|
|||
padding: .5em;
|
||||
}
|
||||
|
||||
#g-server-add ul ul li {
|
||||
#g-videos ul ul li {
|
||||
padding-left: 1.2em;
|
||||
}
|
||||
|
||||
#g-server-add-paths li .ui-icon {
|
||||
#g-videos-paths li .ui-icon {
|
||||
margin-top: .4em;
|
||||
}
|
||||
|
||||
#g-server-add-admin-form .textbox {
|
||||
#g-videos-admin-form .textbox {
|
||||
width: 400px;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,10 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher edit: This file used to be server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
|
||||
class videos_Core {
|
||||
static function check_config($paths=null) {
|
||||
if ($paths === null) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,10 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_event.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additionally, several new functions have been added.
|
||||
class videos_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->get("settings_menu")
|
||||
|
@ -34,7 +38,7 @@ class videos_event_Core {
|
|||
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
||||
$menu->get("add_menu")
|
||||
->append(Menu::factory("dialog")
|
||||
->id("videos")
|
||||
->id("Videos")
|
||||
->label(t("Add videos"))
|
||||
->url(url::site("videos/browse/$item->id")));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,36 +17,60 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file was server_add_installer.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// The installer has been edited to create an additional table and module variable.
|
||||
// The upgrader has been edited to skip everything before version 4, to keep version numbers in sync with server_add.
|
||||
|
||||
class videos_installer {
|
||||
static function install() {
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE {videos_files} (
|
||||
$db->query("CREATE TABLE {videos_entries} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`file` varchar(255) NOT NULL,
|
||||
`checked` boolean default 0,
|
||||
`is_directory` boolean default 0,
|
||||
`item_id` int(9),
|
||||
`parent_id` int(9),
|
||||
`path` varchar(255) NOT NULL,
|
||||
`task_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
// rWatcher Edit: My Table.
|
||||
$db->query("CREATE TABLE {items_videos} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`item_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY (`item_id`, `id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
// rWatcher Edit: My Variable.
|
||||
module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts")));
|
||||
module::set_version("videos", 1);
|
||||
|
||||
module::set_version("videos", 4);
|
||||
videos::check_config();
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
$db = Database::instance();
|
||||
|
||||
if ($version < 4) {
|
||||
$db->query("DROP TABLE {videos_files}");
|
||||
$db->query("CREATE TABLE {videos_entries} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`checked` boolean default 0,
|
||||
`is_directory` boolean default 0,
|
||||
`item_id` int(9),
|
||||
`parent_id` int(9),
|
||||
`path` varchar(255) NOT NULL,
|
||||
`task_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
module::set_version("videos", $version = 4);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("videos_configuration");
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS {videos_files};");
|
||||
$db->query("DROP TABLE IF EXISTS {items_videos};");
|
||||
module::delete("videos");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_theme.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additionally, the head function has been reworked to provide a
|
||||
// download link for unplayable videos and references to admin.js are now admin_videos.js.
|
||||
|
||||
class videos_theme_Core {
|
||||
static function head($theme) {
|
||||
$buf = "";
|
||||
|
@ -30,27 +36,26 @@ class videos_theme_Core {
|
|||
$items_video = ORM::factory("items_video")
|
||||
->where("item_id", "=", $item->id)
|
||||
->find();
|
||||
if ($items_video->loaded()) {
|
||||
$view = new View("videos_display_js.html");
|
||||
//$view->embed_code = addslashes($embedded_video->embed_code);
|
||||
return $buf . $view;
|
||||
if (($items_video->loaded()) && (!file_exists($item->resize_path() . ".flv"))) {
|
||||
$buf .= $theme->script("videos_download.js");
|
||||
}
|
||||
}
|
||||
return $buf;
|
||||
}
|
||||
|
||||
static function admin_head($theme) {
|
||||
$buf = "";
|
||||
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
||||
$buf .= $theme->css("videos.css");
|
||||
$buf .= $theme->css("jquery.autocomplete.css");
|
||||
$buf .= $theme->css("videos.css")
|
||||
. $theme->css("jquery.autocomplete.css");
|
||||
$base = url::site("__ARGS__");
|
||||
$csrf = access::csrf_token();
|
||||
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
||||
|
||||
$buf .= $theme->script("jquery.autocomplete.js");
|
||||
$buf .= $theme->script("admin_videos.js");
|
||||
$buf .= $theme->script("jquery.autocomplete.js")
|
||||
. $theme->script("admin_videos.js"); // rWatcher edit.
|
||||
}
|
||||
|
||||
return $buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
* Set up autocomplete on the server path list
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* rWatcher Edit: This file used to be admin.js from server_add module.
|
||||
* All occurences of server_add have been replaced with videos
|
||||
*
|
||||
*/
|
||||
$("document").ready(function() {
|
||||
$("#g-path").autocomplete(
|
||||
base_url.replace("__ARGS__", "admin/videos/autocomplete"), {max: 256});
|
||||
|
|
|
@ -1,36 +1,41 @@
|
|||
/**
|
||||
* rWatcher Edit: This file used to be server_add.js from server_add module.
|
||||
* All occurences of server-add have been replaced with videos
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.widget("ui.gallery_server_add", {
|
||||
$.widget("ui.gallery_videos", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
$("#g-server-add-add-button", this.element).click(function(event) {
|
||||
$("#g-videos-add-button", this.element).click(function(event) {
|
||||
event.preventDefault();
|
||||
$(".g-progress-bar", this.element).
|
||||
progressbar().
|
||||
progressbar("value", 0);
|
||||
$("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); });
|
||||
$("#g-videos-progress", this.element).slideDown("fast", function() { self.start_add(); });
|
||||
});
|
||||
$("#g-server-add-pause-button", this.element).click(function(event) {
|
||||
$("#g-videos-pause-button", this.element).click(function(event) {
|
||||
self.pause = true;
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).show();
|
||||
$("#g-videos-pause-button", this.element).hide();
|
||||
$("#g-videos-continue-button", this.element).show();
|
||||
});
|
||||
$("#g-server-add-continue-button", this.element).click(function(event) {
|
||||
$("#g-videos-continue-button", this.element).click(function(event) {
|
||||
self.pause = false;
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
$("#g-videos-pause-button", this.element).show();
|
||||
$("#g-videos-continue-button", this.element).hide();
|
||||
self.run_add();
|
||||
});
|
||||
$("#g-server-add-close-button", this.element).click(function(event) {
|
||||
$("#g-videos-close-button", this.element).click(function(event) {
|
||||
$("#g-dialog").dialog("close");
|
||||
window.location.reload();
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
$("#g-videos-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
$("#g-videos-tree span.g-file, #g-videos-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
$("#g-videos-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
||||
|
@ -48,8 +53,8 @@
|
|||
paths.push($(this).attr("ref"));
|
||||
});
|
||||
|
||||
$("#g-server-add-add-button", this.element).hide();
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
$("#g-videos-add-button", this.element).hide();
|
||||
$("#g-videos-pause-button", this.element).show();
|
||||
|
||||
$.ajax({
|
||||
url: START_URL,
|
||||
|
@ -77,10 +82,10 @@
|
|||
$("#g-status").html(data.status);
|
||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||
if (data.done) {
|
||||
$("#g-server-add-progress", this.element).slideUp();
|
||||
$("#g-server-add-add-button", this.element).show();
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
$("#g-videos-progress", this.element).slideUp();
|
||||
$("#g-videos-add-button", this.element).show();
|
||||
$("#g-videos-pause-button", this.element).hide();
|
||||
$("#g-videos-continue-button", this.element).hide();
|
||||
} else {
|
||||
if (!self.pause) {
|
||||
setTimeout(function() { self.run_add(); }, 25);
|
||||
|
@ -99,11 +104,11 @@
|
|||
$.ajax({
|
||||
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
||||
success: function(data, textStatus) {
|
||||
$("#g-server-add-tree", self.element).html(data);
|
||||
$("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
|
||||
$("#g-videos-tree", self.element).html(data);
|
||||
$("#g-videos-tree span.g-directory", self.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
$("#g-videos-tree span.g-file, #g-videos-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
}
|
||||
|
@ -115,10 +120,10 @@
|
|||
*/
|
||||
select_file: function (event) {
|
||||
$(event.target).toggleClass("selected");
|
||||
if ($("#g-server-add span.selected").length) {
|
||||
$("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
|
||||
if ($("#g-videos span.selected").length) {
|
||||
$("#g-videos-add-button").enable(true).removeClass("ui-state-disabled");
|
||||
} else {
|
||||
$("#g-server-add-add-button").enable(false).addClass("ui-state-disabled");
|
||||
$("#g-videos-add-button").enable(false).addClass("ui-state-disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
8
3.0/modules/videos/js/videos_download.js
Normal file
8
3.0/modules/videos/js/videos_download.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* rWatcher Edit: This file is one of mine.
|
||||
*
|
||||
*/
|
||||
$("document").ready(function() {
|
||||
var original_url = document.getElementById('g-videos-full-url');
|
||||
$("#g-movie").replaceWith("<div id=\"g-movie\" class=\"ui-helper-clearfix\"><center><a href=\"" + original_url.href + "\">Click Here to Download Video.</a></center></div>");
|
||||
});
|
1030
3.0/modules/videos/models/item.php
Normal file
1030
3.0/modules/videos/models/item.php
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -18,5 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Note: This file is mine.
|
||||
class Items_video_Model extends ORM {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,5 +17,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Videos_File_Model extends ORM {
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_entry.php.
|
||||
class Videos_Entry_Model_Core extends ORM {
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
name = "Videos"
|
||||
description = "Allows authorized users to load videos directly from your web server"
|
||||
version = 1
|
||||
version = 4
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be admin_server_add.html.php ?>
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Add videos from server administration") ?> </h1>
|
||||
<div class="g-block-content">
|
||||
<?= $form ?>
|
||||
<h2><?= t("Authorized paths") ?></h2>
|
||||
<ul id="g-server-add-paths">
|
||||
<ul id="g-videos-paths">
|
||||
<? if (empty($paths)): ?>
|
||||
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
||||
<? endif ?>
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?
|
||||
// rWatcher Edit: This is a combination of Gallery's movieplayer.html.php file and
|
||||
// some custom edits.
|
||||
|
||||
$items_video = ORM::factory("items_video")
|
||||
->where("item_id", "=", $item->id)
|
||||
->find();
|
||||
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
||||
print html::anchor(str_replace("?m=", ".flv?m=", $item->resize_url(true)), "", $attrs);
|
||||
} else if ($items_video->loaded() && !(file_exists($item->resize_path() . ".flv"))) {
|
||||
print "<a href=\"" . $item->file_url(true) . "\" class=\"g-movie\" id=\"g-videos-full-url\"></a>";
|
||||
} else {
|
||||
print html::anchor($item->file_url(true), "", $attrs);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
|
||||
<? if (!file_exists($item->resize_path() . ".flv")) { ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#g-movie").replaceWith("<center><a href=\"<?= $item->file_url(true) ?>\">Click Here to Download Video.</a></center>");
|
||||
});
|
||||
</script>
|
||||
<? } ?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be server_add_tree.html.php ?>
|
||||
<li class="ui-icon-left">
|
||||
<span class="ui-icon ui-icon-folder-open"></span>
|
||||
<span class="g-directory" ref="">
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be server_add_tree_dialog.html.php, server_add has been replaced with videos ?>
|
||||
<script type="text/javascript">
|
||||
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
||||
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
||||
</script>
|
||||
|
||||
<div id="g-server-add">
|
||||
<h1 style="display: none;"><?= t("Add Videos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
||||
<div id="g-videos">
|
||||
<h1 style="display: none;"><?= t("Add Photos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
||||
|
||||
<p id="g-description"><?= t("Videos will be added to album:") ?></p>
|
||||
<p id="g-description"><?= t("Photos will be added to album:") ?></p>
|
||||
<ul class="g-breadcrumbs">
|
||||
<? $i = 0 ?>
|
||||
<? foreach ($item->parents() as $parent): ?>
|
||||
|
@ -17,35 +18,35 @@
|
|||
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
||||
</ul>
|
||||
|
||||
<ul id="g-server-add-tree" class="g-checkbox-tree">
|
||||
<ul id="g-videos-tree" class="g-checkbox-tree">
|
||||
<?= $tree ?>
|
||||
</ul>
|
||||
|
||||
<div id="g-server-add-progress" style="display: none">
|
||||
<div id="g-videos-progress" style="display: none">
|
||||
<div class="g-progress-bar"></div>
|
||||
<div id="g-status"></div>
|
||||
</div>
|
||||
|
||||
<span>
|
||||
<button id="g-server-add-add-button" class="ui-state-default ui-state-disabled ui-corner-all"
|
||||
<button id="g-videos-add-button" class="ui-state-default ui-state-disabled ui-corner-all"
|
||||
disabled="disabled">
|
||||
<?= t("Add") ?>
|
||||
</button>
|
||||
<button id="g-server-add-pause-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<button id="g-videos-pause-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<?= t("Pause") ?>
|
||||
</button>
|
||||
<button id="g-server-add-continue-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<button id="g-videos-continue-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<?= t("Continue") ?>
|
||||
</button>
|
||||
|
||||
<button id="g-server-add-close-button" class="ui-state-default ui-corner-all">
|
||||
<button id="g-videos-close-button" class="ui-state-default ui-corner-all">
|
||||
<?= t("Close") ?>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#g-server-add").ready(function() {
|
||||
$("#g-server-add").gallery_server_add();
|
||||
$("#g-videos").ready(function() {
|
||||
$("#g-videos").gallery_videos();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
// Check and see if any photos were taken in January,
|
||||
// If so, make the month title into a clickable link.
|
||||
print "<div id=\"g-calendar-grid\">";
|
||||
if (date("n", $items_for_year[$counter]->captured) == 1) {
|
||||
if ((count($items_for_year) > 0) && (date("n", $items_for_year[$counter]->captured) == 1)) {
|
||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||
} else {
|
||||
$month_url = "";
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
|
||||
// rWatcher edit: include MP4Info.php library.
|
||||
include MODPATH . "noffmpeg/libraries/MP4Info.php";
|
||||
|
||||
class movie_Core {
|
||||
|
@ -61,7 +62,7 @@ class movie_Core {
|
|||
}
|
||||
|
||||
static function extract_frame($input_file, $output_file) {
|
||||
$ffmpeg = self::find_ffmpeg();
|
||||
$ffmpeg = movie::find_ffmpeg();
|
||||
if (empty($ffmpeg)) {
|
||||
// BEGIN rWatcher Edit.
|
||||
copy(MODPATH . "noffmpeg/images/missing_movie.png", $output_file);
|
||||
|
@ -89,27 +90,23 @@ class movie_Core {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the path to the ffmpeg binary if one exists and is executable, or null.
|
||||
*/
|
||||
static function find_ffmpeg() {
|
||||
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
|
||||
$graphics_path = module::get_var("gallery", "graphics_toolkit_path", null);
|
||||
|
||||
putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") .
|
||||
":/usr/local/bin:/opt/local/bin:/opt/bin");
|
||||
if (function_exists("exec")) {
|
||||
$ffmpeg_path = exec("which ffmpeg");
|
||||
}
|
||||
|
||||
$ffmpeg_path = system::find_binary(
|
||||
"ffmpeg", module::get_var("gallery", "graphics_toolkit_path"));
|
||||
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
|
||||
}
|
||||
return $ffmpeg_path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the width, height, mime_type and extension of the given movie file.
|
||||
*/
|
||||
static function get_file_metadata($file_path) {
|
||||
$ffmpeg = self::find_ffmpeg();
|
||||
$ffmpeg = movie::find_ffmpeg();
|
||||
if (empty($ffmpeg)) {
|
||||
// BEGIN rWatcher Edit.
|
||||
$pi = pathinfo($file_path);
|
||||
|
@ -147,4 +144,4 @@ class movie_Core {
|
|||
return array($width, $height, $mime_type, $extension);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
164
3.1/modules/noffmpeg/views/form_uploadify.html.php
Normal file
164
3.1/modules/noffmpeg/views/form_uploadify.html.php
Normal file
|
@ -0,0 +1,164 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script>
|
||||
<script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script>
|
||||
<script type="text/javascript">
|
||||
<? $flash_minimum_version = "9.0.24" ?>
|
||||
<? $movies_allowed = true; // rWatcher EDIT ?>
|
||||
var success_count = 0;
|
||||
var error_count = 0;
|
||||
var updating = 0;
|
||||
$("#g-add-photos-canvas").ready(function () {
|
||||
var update_status = function() {
|
||||
if (updating) {
|
||||
// poor man's mutex
|
||||
setTimeout(function() { update_status(); }, 500);
|
||||
}
|
||||
updating = 1;
|
||||
$.get("<?= url::site("uploader/status/_S/_E") ?>"
|
||||
.replace("_S", success_count).replace("_E", error_count),
|
||||
function(data) {
|
||||
$("#g-add-photos-status-message").html(data);
|
||||
updating = 0;
|
||||
});
|
||||
};
|
||||
|
||||
if (swfobject.hasFlashPlayerVersion("<?= $flash_minimum_version ?>")) {
|
||||
$("#g-uploadify").uploadify({
|
||||
width: 150,
|
||||
height: 33,
|
||||
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
|
||||
script: "<?= url::site("uploader/add_photo/{$album->id}") ?>",
|
||||
scriptData: <?= json_encode($script_data) ?>,
|
||||
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.GIF;*.JPG;*.JPEG;*.PNG<? if ($movies_allowed): ?>;*.flv;*.mp4;*.m4v;*.FLV;*.MP4;*.M4V<? endif ?>",
|
||||
fileDesc: <?= t("Photos and movies")->for_js() ?>,
|
||||
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
|
||||
simUploadLimit: <?= $simultaneous_upload_limit ?>,
|
||||
wmode: "transparent",
|
||||
hideButton: true, /* should be true */
|
||||
auto: true,
|
||||
multi: true,
|
||||
onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) {
|
||||
$("#g-upload-cancel-all")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
$("#g-upload-done")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
return true;
|
||||
},
|
||||
onClearQueue: function(event) {
|
||||
$("#g-upload-cancel-all")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
$("#g-upload-done")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
return true;
|
||||
},
|
||||
onComplete: function(event, queueID, fileObj, response, data) {
|
||||
var re = /^error: (.*)$/i;
|
||||
var msg = re.exec(response);
|
||||
$("#g-add-photos-status ul").append(
|
||||
"<li id=\"q" + queueID + "\" class=\"g-success\">" + fileObj.name + " - " +
|
||||
<?= t("Completed")->for_js() ?> + "</li>");
|
||||
setTimeout(function() { $("#q" + queueID).slideUp("slow").remove() }, 5000);
|
||||
success_count++;
|
||||
update_status();
|
||||
return true;
|
||||
},
|
||||
onError: function(event, queueID, fileObj, errorObj) {
|
||||
var msg = " - ";
|
||||
if (errorObj.type == "HTTP") {
|
||||
if (errorObj.info == "500") {
|
||||
msg += <?= t("Unable to process this file")->for_js() ?>;
|
||||
// Server error - check server logs
|
||||
} else if (errorObj.info == "404") {
|
||||
msg += <?= t("The upload script was not found.")->for_js() ?>;
|
||||
// Server script not found
|
||||
} else {
|
||||
// Server Error: status: errorObj.info
|
||||
msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info));
|
||||
}
|
||||
} else if (errorObj.type == "File Size") {
|
||||
var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit);
|
||||
msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB';
|
||||
} else {
|
||||
msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
|
||||
.replace("__INFO__", errorObj.info)
|
||||
.replace("__TYPE__", errorObj.type));
|
||||
}
|
||||
$("#g-add-photos-status ul").append(
|
||||
"<li id=\"q" + queueID + "\" class=\"g-error\">" + fileObj.name + msg + "</li>");
|
||||
$("#g-uploadify").uploadifyCancel(queueID);
|
||||
error_count++;
|
||||
update_status();
|
||||
},
|
||||
onSelect: function(event) {
|
||||
if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) {
|
||||
$("#g-upload-cancel-all")
|
||||
.removeClass("ui-state-disabled")
|
||||
.attr("disabled", null);
|
||||
$("#g-upload-done")
|
||||
.addClass("ui-state-disabled")
|
||||
.attr("disabled", "disabled");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(".requires-flash").hide();
|
||||
$(".no-flash").show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="requires-flash">
|
||||
<? if ($suhosin_session_encrypt || (identity::active_user()->admin && !$movies_allowed)): ?>
|
||||
<div class="g-message-block g-info">
|
||||
<? if ($suhosin_session_encrypt): ?>
|
||||
<p class="g-error">
|
||||
<?= t("Error: your server is configured to use the <a href=\"%encrypt_url\"><code>suhosin.session.encrypt</code></a> setting from <a href=\"%suhosin_url\">Suhosin</a>. You must disable this setting to upload photos.",
|
||||
array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt",
|
||||
"suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
|
||||
<? if (identity::active_user()->admin && !$movies_allowed): ?>
|
||||
<p class="g-warning">
|
||||
<?= t("Can't find <i>ffmpeg</i> on your system. Movie uploading disabled. <a href=\"%help_url\">Help!</a>", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<div>
|
||||
<p>
|
||||
<?= t("Photos will be uploaded to album: ") ?>
|
||||
</p>
|
||||
<ul class="g-breadcrumbs ui-helper-clearfix">
|
||||
<? foreach ($album->parents() as $i => $parent): ?>
|
||||
<li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li>
|
||||
<? endforeach ?>
|
||||
<li class="g-active"> <?= html::purify($album->title) ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="g-add-photos-canvas">
|
||||
<button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button>
|
||||
<span id="g-uploadify"></span>
|
||||
</div>
|
||||
<div id="g-add-photos-status">
|
||||
<ul id="g-action-status" class="g-message-block">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="no-flash" style="display: none">
|
||||
<p>
|
||||
<?= t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version)) ?>
|
||||
</p>
|
||||
<a href="http://www.adobe.com/go/getflashplayer">
|
||||
<img src="<?= request::protocol() ?>://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
|
||||
alt=<?= t("Get Adobe Flash Player")->for_js() ?> />
|
||||
</a>
|
||||
</div>
|
|
@ -19,7 +19,15 @@
|
|||
*/
|
||||
class tagsinalbum_installer {
|
||||
static function install() {
|
||||
module::set_version("tagsinalbum", 1);
|
||||
module::set_var("tagsinalbum", "max_display_tags", 0);
|
||||
module::set_version("tagsinalbum", 2);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
if ($version == 1) {
|
||||
module::set_var("tagsinalbum", "max_display_tags", 0);
|
||||
module::set_version("tagsinalbum", $version = 2);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = "Tags In Album"
|
||||
description = "Creates a sidebar block to display tags used by photos and videos in the current album."
|
||||
version = 1
|
||||
version = 2
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
$display_tags[] = array(html::clean($tag->name), $tag->url());
|
||||
$last_tagid = $one_tag->id;
|
||||
}
|
||||
if (module::get_var("tagsinalbum", "max_display_tags") > 0) {
|
||||
if (count($display_tags) == module::get_var("tagsinalbum", "max_display_tags")) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the array.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
name = "Theme generator"
|
||||
name = "Theme Roller"
|
||||
description = "Use a JQuery UI theme to create a Gallery3 Theme"
|
||||
version = 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,10 +17,14 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher EDIT: This file used to be admin_server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
|
||||
class Admin_Videos_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Add videos from server");
|
||||
$view->page_title = t("Add from server");
|
||||
$view->content = new View("admin_videos.html");
|
||||
$view->content->form = $this->_get_admin_form();
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}"));
|
||||
|
|
144
3.1/modules/videos/controllers/file_proxy.php
Normal file
144
3.1/modules/videos/controllers/file_proxy.php
Normal file
|
@ -0,0 +1,144 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
/**
|
||||
* Proxy access to files in var/albums and var/resizes, making sure that the session user has
|
||||
* access to view these files.
|
||||
*
|
||||
* Security Philosophy: we do not use the information provided to find if the file exists on
|
||||
* disk. We use this information only to locate the correct item in the database and then we
|
||||
* *only* use information from the database to find and proxy the correct file. This way all user
|
||||
* input is sanitized against the database before we perform any file I/O.
|
||||
*/
|
||||
class File_Proxy_Controller extends Controller {
|
||||
const ALLOW_PRIVATE_GALLERY = true;
|
||||
public function __call($function, $args) {
|
||||
// request_uri: gallery3/var/albums/foo/bar.jpg?m=1234
|
||||
$request_uri = rawurldecode(Input::instance()->server("REQUEST_URI"));
|
||||
|
||||
// get rid of query parameters
|
||||
// request_uri: gallery3/var/albums/foo/bar.jpg
|
||||
$request_uri = preg_replace("/\?.*/", "", $request_uri);
|
||||
|
||||
// var_uri: gallery3/var/
|
||||
$var_uri = url::file("var/");
|
||||
|
||||
// Make sure that the request is for a file inside var
|
||||
$offset = strpos(rawurldecode($request_uri), $var_uri);
|
||||
if ($offset !== 0) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// file_uri: albums/foo/bar.jpg
|
||||
$file_uri = substr($request_uri, strlen($var_uri));
|
||||
|
||||
// type: albums
|
||||
// path: foo/bar.jpg
|
||||
list ($type, $path) = explode("/", $file_uri, 2);
|
||||
if ($type != "resizes" && $type != "albums" && $type != "thumbs") {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// 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 .flv, .mp4 or .m4v file would
|
||||
// have been converted to a .jpg. So try some alternate types:
|
||||
if (preg_match('/.jpg$/', $path)) {
|
||||
// rWatcher Mod: look for videos with file extensions supported by the videos module in addition to flv mp4 and m4v
|
||||
// Original Line: foreach (array("flv", "mp4", "m4v") as $ext) {
|
||||
foreach (array_merge(array("flv", "mp4", "m4v"), unserialize(module::get_var("videos", "allowed_extensions"))) as $ext) {
|
||||
$movie_path = preg_replace('/.jpg$/', ".$ext", $path);
|
||||
$item = item::find_by_path($movie_path);
|
||||
if ($item->loaded()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// rWatcher Mod:
|
||||
// If we're looking for a .flv then it's it's possible that we're requesting a flash resize
|
||||
// for a movie.
|
||||
if (strtolower(substr($path, strlen($path)-4)) == ".flv") {
|
||||
$movie_path = str_ireplace(".flv", "", $path);
|
||||
$item = ORM::factory("item")->where("relative_path_cache", "=", $movie_path)->find();
|
||||
}
|
||||
// END rWatcher Mod
|
||||
}
|
||||
|
||||
if (!$item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Make sure we have access to the item
|
||||
if (!access::can("view", $item)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Make sure we have view_full access to the original
|
||||
if ($type == "albums" && !access::can("view_full", $item)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Don't try to load a directory
|
||||
if ($type == "albums" && $item->is_album()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
if ($type == "albums") {
|
||||
$file = $item->file_path();
|
||||
} else if ($type == "resizes") {
|
||||
$file = $item->resize_path();
|
||||
// rWatcher MOD
|
||||
// If the resize is for a movie, assume it needs a .flv extension.
|
||||
if ($item->is_movie()) {
|
||||
$file = $file . ".flv";
|
||||
}
|
||||
// End rWatcher MOD
|
||||
} else {
|
||||
$file = $item->thumb_path();
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
header("Content-Length: " . filesize($file));
|
||||
|
||||
header("Pragma:");
|
||||
// Check that the content hasn't expired or it wasn't changed since cached
|
||||
expires::check(2592000, $item->updated);
|
||||
|
||||
// We don't need to save the session for this request
|
||||
Session::instance()->abort_save();
|
||||
|
||||
expires::set(2592000, $item->updated); // 30 days
|
||||
|
||||
// Dump out the image. If the item is a movie, then its thumbnail will be a JPG.
|
||||
if ($item->is_movie() && $type != "albums") {
|
||||
header("Content-Type: image/jpeg");
|
||||
} else {
|
||||
header("Content-Type: $item->mime_type");
|
||||
}
|
||||
Kohana::close_buffers(false);
|
||||
readfile($file);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additional editing has also been done in three places to expand accepted file
|
||||
// extensions and to create resizes and an extra db entry for items_videos.
|
||||
|
||||
class Videos_Controller extends Admin_Controller {
|
||||
public function browse($id) {
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||
|
@ -24,6 +30,12 @@ class Videos_Controller extends Admin_Controller {
|
|||
$files[] = $path;
|
||||
}
|
||||
|
||||
// Clean leftover task rows. There really should be support for this in the task framework
|
||||
db::build()
|
||||
->where("task_id", "NOT IN", db::build()->select("id")->from("tasks"))
|
||||
->delete("videos_entries")
|
||||
->execute();
|
||||
|
||||
$item = ORM::factory("item", $id);
|
||||
$view = new View("videos_tree_dialog.html");
|
||||
$view->item = $item;
|
||||
|
@ -55,6 +67,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
if (!is_dir($file)) {
|
||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||
// rWatcher Edit
|
||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
continue;
|
||||
|
@ -74,23 +87,28 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Begin the task of adding files.
|
||||
* Begin the task of adding photos.
|
||||
*/
|
||||
public function start() {
|
||||
access::verify_csrf();
|
||||
$item = ORM::factory("item", Input::instance()->get("item_id"));
|
||||
|
||||
foreach (Input::instance()->post("paths") as $path) {
|
||||
if (videos::is_valid_path($path)) {
|
||||
$paths[] = array($path, null);
|
||||
}
|
||||
}
|
||||
|
||||
$task_def = Task_Definition::factory()
|
||||
->callback("Videos_Controller::add")
|
||||
->description(t("Add videos from the local server"))
|
||||
->description(t("Add photos or movies from the local server"))
|
||||
->name(t("Add from server"));
|
||||
$task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths));
|
||||
$task = task::create($task_def, array("item_id" => $item->id));
|
||||
|
||||
foreach (Input::instance()->post("paths") as $path) {
|
||||
if (videos::is_valid_path($path)) {
|
||||
$entry = ORM::factory("videos_entry");
|
||||
$entry->path = $path;
|
||||
$entry->is_directory = intval(is_dir($path));
|
||||
$entry->parent_id = null;
|
||||
$entry->task_id = $task->id;
|
||||
$entry->save();
|
||||
}
|
||||
}
|
||||
|
||||
json::reply(
|
||||
array("result" => "started",
|
||||
|
@ -99,7 +117,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Run the task of adding files
|
||||
* Run the task of adding photos
|
||||
*/
|
||||
function run($task_id) {
|
||||
access::verify_csrf();
|
||||
|
@ -119,7 +137,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
|
||||
/**
|
||||
* This is the task code that adds photos and albums. It first examines all the target files
|
||||
* and creates a set of Server_Add_File_Models, then runs through the list of models and adds
|
||||
* and creates a set of Server_Add_Entry_Models, then runs through the list of models and adds
|
||||
* them one at a time.
|
||||
*/
|
||||
static function add($task) {
|
||||
|
@ -129,6 +147,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
switch ($mode) {
|
||||
case "init":
|
||||
$task->set("mode", "build-file-list");
|
||||
$task->set("dirs_scanned", 0);
|
||||
$task->percent_complete = 0;
|
||||
$task->status = t("Starting up");
|
||||
batch::start();
|
||||
|
@ -137,59 +156,64 @@ class Videos_Controller extends Admin_Controller {
|
|||
case "build-file-list": // 0% to 10%
|
||||
// We can't fit an arbitrary number of paths in a task, so store them in a separate table.
|
||||
// Don't use an iterator here because we can't get enough control over it when we're dealing
|
||||
// with a deep hierarchy and we don't want to go over our time quota. The queue is in the
|
||||
// form [path, parent_id] where the parent_id refers to another Server_Add_File_Model. We
|
||||
// have this extra level of abstraction because we don't know its Item_Model id yet.
|
||||
$queue = $task->get("queue");
|
||||
// with a deep hierarchy and we don't want to go over our time quota.
|
||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||
$dirs_scanned = $task->get("dirs_scanned");
|
||||
while (microtime(true) - $start < 0.5) {
|
||||
// Process every directory that doesn't yet have a parent id, these are the
|
||||
// paths that we're importing.
|
||||
$entry = ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->where("is_directory", "=", 1)
|
||||
->where("checked", "=", 0)
|
||||
->order_by("id", "ASC")
|
||||
->find();
|
||||
|
||||
while ($queue && microtime(true) - $start < 0.5) {
|
||||
list($file, $parent_entry_id) = array_shift($queue);
|
||||
// Ignore the staging directories as directories to be imported.
|
||||
if (empty($paths[$file])) {
|
||||
$entry = ORM::factory("videos_file");
|
||||
$entry->task_id = $task->id;
|
||||
$entry->file = $file;
|
||||
$entry->parent_id = $parent_entry_id;
|
||||
$entry->save();
|
||||
$entry_id = $entry->id;
|
||||
} else {
|
||||
$entry_id = null;
|
||||
}
|
||||
|
||||
$file = preg_quote($file);
|
||||
foreach (glob("$file/*") as $child) {
|
||||
if (is_dir($child)) {
|
||||
$queue[] = array($child, $entry_id);
|
||||
} else {
|
||||
$ext = strtolower(pathinfo($child, PATHINFO_EXTENSION));
|
||||
//if (in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) &&
|
||||
if (in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) &&
|
||||
filesize($child) > 0) {
|
||||
$child_entry = ORM::factory("videos_file");
|
||||
$child_entry->task_id = $task->id;
|
||||
$child_entry->file = $child;
|
||||
$child_entry->parent_id = $entry_id;
|
||||
$child_entry->save();
|
||||
}
|
||||
if ($entry->loaded()) {
|
||||
$child_paths = glob(preg_quote($entry->path) . "/*");
|
||||
if (!$child_paths) {
|
||||
$child_paths = glob("{$entry->path}/*");
|
||||
}
|
||||
foreach ($child_paths as $child_path) {
|
||||
if (!is_dir($child_path)) {
|
||||
$ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION));
|
||||
// rWatcher Edit.
|
||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) ||
|
||||
// !filesize($child_path)) {
|
||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) ||
|
||||
!filesize($child_path)) {
|
||||
// Not importable, skip it.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$child_entry = ORM::factory("videos_entry");
|
||||
$child_entry->task_id = $task->id;
|
||||
$child_entry->path = $child_path;
|
||||
$child_entry->parent_id = $entry->id; // null if the parent was a staging dir
|
||||
$child_entry->is_directory = is_dir($child_path);
|
||||
$child_entry->save();
|
||||
}
|
||||
|
||||
// We've processed this entry, mark it as done.
|
||||
$entry->checked = 1;
|
||||
$entry->save();
|
||||
$dirs_scanned++;
|
||||
}
|
||||
}
|
||||
|
||||
// We have no idea how long this can take because we have no idea how deep the tree
|
||||
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
|
||||
// over 10% in percent_complete.
|
||||
$task->set("queue", $queue);
|
||||
$task->set("dirs_scanned", $dirs_scanned);
|
||||
$task->percent_complete = min($task->percent_complete + 0.1, 10);
|
||||
$task->status = t2(
|
||||
"Found one file", "Found %count files",
|
||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
||||
$task->status = t2("Scanned one directory", "Scanned %count directories", $dirs_scanned);
|
||||
|
||||
if (!$queue) {
|
||||
if (!$entry->loaded()) {
|
||||
$task->set("mode", "add-files");
|
||||
$task->set(
|
||||
"total_files",
|
||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
||||
ORM::factory("videos_entry")->where("task_id", "=", $task->id)->count_all());
|
||||
$task->percent_complete = 10;
|
||||
}
|
||||
break;
|
||||
|
@ -201,7 +225,7 @@ class Videos_Controller extends Admin_Controller {
|
|||
// Ordering by id ensures that we add them in the order that we created the entries, which
|
||||
// will create albums first. Ignore entries which already have an Item_Model attached,
|
||||
// they're done.
|
||||
$entries = ORM::factory("videos_file")
|
||||
$entries = ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->where("item_id", "IS", null)
|
||||
->order_by("id", "ASC")
|
||||
|
@ -220,43 +244,59 @@ class Videos_Controller extends Admin_Controller {
|
|||
|
||||
// Look up the parent item for this entry. By now it should exist, but if none was
|
||||
// specified, then this belongs as a child of the current item.
|
||||
$parent_entry = ORM::factory("videos_file", $entry->parent_id);
|
||||
$parent_entry = ORM::factory("videos_entry", $entry->parent_id);
|
||||
if (!$parent_entry->loaded()) {
|
||||
$parent = ORM::factory("item", $task->get("item_id"));
|
||||
} else {
|
||||
$parent = ORM::factory("item", $parent_entry->item_id);
|
||||
}
|
||||
|
||||
$name = basename($entry->file);
|
||||
$name = basename($entry->path);
|
||||
$title = item::convert_filename_to_title($name);
|
||||
if (is_dir($entry->file)) {
|
||||
if ($entry->is_directory) {
|
||||
$album = ORM::factory("item");
|
||||
$album->type = "album";
|
||||
$album->parent_id = $parent->id;
|
||||
$album->name = $name;
|
||||
$album->title = $title;
|
||||
$album->owner_id = $owner_id;
|
||||
$album->sort_order = $parent->sort_order;
|
||||
$album->sort_column = $parent->sort_column;
|
||||
$album->save();
|
||||
$entry->item_id = $album->id;
|
||||
} else {
|
||||
try {
|
||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
||||
if (in_array($extension, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
if (in_array($extension, array("gif", "png", "jpg", "jpeg"))) {
|
||||
$photo = ORM::factory("item");
|
||||
$photo->type = "photo";
|
||||
$photo->parent_id = $parent->id;
|
||||
$photo->set_data_file($entry->path);
|
||||
$photo->name = $name;
|
||||
$photo->title = $title;
|
||||
$photo->owner_id = $owner_id;
|
||||
$photo->save();
|
||||
$entry->item_id = $photo->id;
|
||||
// rWatcher EDIT
|
||||
//} else if (in_array($extension, array("flv", "mp4", "m4v"))) {
|
||||
} else if (in_array($extension, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||
$movie = ORM::factory("item");
|
||||
$movie->type = "movie";
|
||||
$movie->parent_id = $parent->id;
|
||||
$movie->set_data_file($entry->file);
|
||||
$movie->set_data_file($entry->path);
|
||||
$movie->name = $name;
|
||||
$movie->title = $title;
|
||||
$movie->owner_id = $owner_id;
|
||||
$movie->save();
|
||||
$entry->item_id = $movie->id;
|
||||
// rWatcher EDIT: Add record to items_video db.
|
||||
$items_video = ORM::factory("items_video");
|
||||
$items_video->item_id = $movie->id;
|
||||
$items_video->save();
|
||||
if (file_exists($entry->file . ".flv")) {
|
||||
copy($entry->file . ".flv", $movie->resize_path() . ".flv");
|
||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->file . ".flv");
|
||||
// rWatcher EDIT: Scan for flv resizes and copy to resize directory.
|
||||
if (file_exists($entry->path . ".flv")) {
|
||||
copy($entry->path . ".flv", $movie->resize_path() . ".flv");
|
||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->path . ".flv");
|
||||
$movie->height = $vid_height;
|
||||
$movie->width = $vid_width;
|
||||
$movie->save();
|
||||
|
@ -266,12 +306,12 @@ class Videos_Controller extends Admin_Controller {
|
|||
// process. But just in, case.. set this to a non-null value so that we skip this
|
||||
// entry.
|
||||
$entry->item_id = 0;
|
||||
$task->log("Skipping unknown file type: $entry->file");
|
||||
$task->log("Skipping unknown file type: {$entry->path}");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
||||
$entry->item_id = 0;
|
||||
$task->log("Skipping invalid file: $entry->file");
|
||||
$task->log("Skipping invalid file: {$entry->file}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,12 +330,11 @@ class Videos_Controller extends Admin_Controller {
|
|||
$task->done = true;
|
||||
$task->state = "success";
|
||||
$task->percent_complete = 100;
|
||||
db::build()
|
||||
->delete("videos_files")
|
||||
ORM::factory("videos_entry")
|
||||
->where("task_id", "=", $task->id)
|
||||
->execute();
|
||||
message::info(t2("Successfully added one file",
|
||||
"Successfully added %count files",
|
||||
->delete_all();
|
||||
message::info(t2("Successfully added one photo / album",
|
||||
"Successfully added %count photos / albums",
|
||||
$task->get("completed_files")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
#g-server-add button {
|
||||
#g-videos button {
|
||||
margin-bottom: .5em;
|
||||
}
|
||||
|
||||
#g-server-add-tree {
|
||||
#g-videos-tree {
|
||||
cursor: pointer;
|
||||
padding-left: 4px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
#g-server-add-tree li {
|
||||
#g-videos-tree li {
|
||||
padding: 0;
|
||||
float: none;
|
||||
}
|
||||
|
||||
#g-server-add-tree span.selected {
|
||||
#g-videos-tree span.selected {
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
#g-server-add-tree {
|
||||
#g-videos-tree {
|
||||
border: 1px solid #ccc;
|
||||
height: 20em;
|
||||
overflow: auto;
|
||||
|
@ -25,14 +25,14 @@
|
|||
padding: .5em;
|
||||
}
|
||||
|
||||
#g-server-add ul ul li {
|
||||
#g-videos ul ul li {
|
||||
padding-left: 1.2em;
|
||||
}
|
||||
|
||||
#g-server-add-paths li .ui-icon {
|
||||
#g-videos-paths li .ui-icon {
|
||||
margin-top: .4em;
|
||||
}
|
||||
|
||||
#g-server-add-admin-form .textbox {
|
||||
#g-videos-admin-form .textbox {
|
||||
width: 400px;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,10 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher edit: This file used to be server_add.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
|
||||
class videos_Core {
|
||||
static function check_config($paths=null) {
|
||||
if ($paths === null) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,10 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_event.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additionally, several new functions have been added.
|
||||
class videos_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->get("settings_menu")
|
||||
|
@ -34,7 +38,7 @@ class videos_event_Core {
|
|||
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
||||
$menu->get("add_menu")
|
||||
->append(Menu::factory("dialog")
|
||||
->id("videos")
|
||||
->id("Videos")
|
||||
->label(t("Add videos"))
|
||||
->url(url::site("videos/browse/$item->id")));
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,36 +17,60 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file was server_add_installer.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// The installer has been edited to create an additional table and module variable.
|
||||
// The upgrader has been edited to skip everything before version 4, to keep version numbers in sync with server_add.
|
||||
|
||||
class videos_installer {
|
||||
static function install() {
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE {videos_files} (
|
||||
$db->query("CREATE TABLE {videos_entries} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`file` varchar(255) NOT NULL,
|
||||
`checked` boolean default 0,
|
||||
`is_directory` boolean default 0,
|
||||
`item_id` int(9),
|
||||
`parent_id` int(9),
|
||||
`path` varchar(255) NOT NULL,
|
||||
`task_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
// rWatcher Edit: My Table.
|
||||
$db->query("CREATE TABLE {items_videos} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`item_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY (`item_id`, `id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
// rWatcher Edit: My Variable.
|
||||
module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts")));
|
||||
module::set_version("videos", 1);
|
||||
|
||||
module::set_version("videos", 4);
|
||||
videos::check_config();
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
$db = Database::instance();
|
||||
|
||||
if ($version < 4) {
|
||||
$db->query("DROP TABLE {videos_files}");
|
||||
$db->query("CREATE TABLE {videos_entries} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`checked` boolean default 0,
|
||||
`is_directory` boolean default 0,
|
||||
`item_id` int(9),
|
||||
`parent_id` int(9),
|
||||
`path` varchar(255) NOT NULL,
|
||||
`task_id` int(9) NOT NULL,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
module::set_version("videos", $version = 4);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("videos_configuration");
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS {videos_files};");
|
||||
$db->query("DROP TABLE IF EXISTS {items_videos};");
|
||||
module::delete("videos");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,6 +17,12 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_theme.php.
|
||||
// All occurences of server_add have been replaced with videos.
|
||||
// Additionally, the head function has been reworked to provide a
|
||||
// download link for unplayable videos and references to admin.js are now admin_videos.js.
|
||||
|
||||
class videos_theme_Core {
|
||||
static function head($theme) {
|
||||
$buf = "";
|
||||
|
@ -30,27 +36,26 @@ class videos_theme_Core {
|
|||
$items_video = ORM::factory("items_video")
|
||||
->where("item_id", "=", $item->id)
|
||||
->find();
|
||||
if ($items_video->loaded()) {
|
||||
$view = new View("videos_display_js.html");
|
||||
//$view->embed_code = addslashes($embedded_video->embed_code);
|
||||
return $buf . $view;
|
||||
if (($items_video->loaded()) && (!file_exists($item->resize_path() . ".flv"))) {
|
||||
$buf .= $theme->script("videos_download.js");
|
||||
}
|
||||
}
|
||||
return $buf;
|
||||
}
|
||||
|
||||
static function admin_head($theme) {
|
||||
$buf = "";
|
||||
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
||||
$buf .= $theme->css("videos.css");
|
||||
$buf .= $theme->css("jquery.autocomplete.css");
|
||||
$buf .= $theme->css("videos.css")
|
||||
. $theme->css("jquery.autocomplete.css");
|
||||
$base = url::site("__ARGS__");
|
||||
$csrf = access::csrf_token();
|
||||
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
||||
|
||||
$buf .= $theme->script("jquery.autocomplete.js");
|
||||
$buf .= $theme->script("admin_videos.js");
|
||||
$buf .= $theme->script("jquery.autocomplete.js")
|
||||
. $theme->script("admin_videos.js"); // rWatcher edit.
|
||||
}
|
||||
|
||||
return $buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
* Set up autocomplete on the server path list
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* rWatcher Edit: This file used to be admin.js from server_add module.
|
||||
* All occurences of server_add have been replaced with videos
|
||||
*
|
||||
*/
|
||||
$("document").ready(function() {
|
||||
$("#g-path").autocomplete(
|
||||
base_url.replace("__ARGS__", "admin/videos/autocomplete"), {max: 256});
|
||||
|
|
|
@ -1,36 +1,41 @@
|
|||
/**
|
||||
* rWatcher Edit: This file used to be server_add.js from server_add module.
|
||||
* All occurences of server-add have been replaced with videos
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
$.widget("ui.gallery_server_add", {
|
||||
$.widget("ui.gallery_videos", {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
$("#g-server-add-add-button", this.element).click(function(event) {
|
||||
$("#g-videos-add-button", this.element).click(function(event) {
|
||||
event.preventDefault();
|
||||
$(".g-progress-bar", this.element).
|
||||
progressbar().
|
||||
progressbar("value", 0);
|
||||
$("#g-server-add-progress", this.element).slideDown("fast", function() { self.start_add(); });
|
||||
$("#g-videos-progress", this.element).slideDown("fast", function() { self.start_add(); });
|
||||
});
|
||||
$("#g-server-add-pause-button", this.element).click(function(event) {
|
||||
$("#g-videos-pause-button", this.element).click(function(event) {
|
||||
self.pause = true;
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).show();
|
||||
$("#g-videos-pause-button", this.element).hide();
|
||||
$("#g-videos-continue-button", this.element).show();
|
||||
});
|
||||
$("#g-server-add-continue-button", this.element).click(function(event) {
|
||||
$("#g-videos-continue-button", this.element).click(function(event) {
|
||||
self.pause = false;
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
$("#g-videos-pause-button", this.element).show();
|
||||
$("#g-videos-continue-button", this.element).hide();
|
||||
self.run_add();
|
||||
});
|
||||
$("#g-server-add-close-button", this.element).click(function(event) {
|
||||
$("#g-videos-close-button", this.element).click(function(event) {
|
||||
$("#g-dialog").dialog("close");
|
||||
window.location.reload();
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
$("#g-videos-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
$("#g-videos-tree span.g-file, #g-videos-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
$("#g-videos-tree span.g-directory", this.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
||||
|
@ -48,8 +53,8 @@
|
|||
paths.push($(this).attr("ref"));
|
||||
});
|
||||
|
||||
$("#g-server-add-add-button", this.element).hide();
|
||||
$("#g-server-add-pause-button", this.element).show();
|
||||
$("#g-videos-add-button", this.element).hide();
|
||||
$("#g-videos-pause-button", this.element).show();
|
||||
|
||||
$.ajax({
|
||||
url: START_URL,
|
||||
|
@ -77,10 +82,10 @@
|
|||
$("#g-status").html(data.status);
|
||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||
if (data.done) {
|
||||
$("#g-server-add-progress", this.element).slideUp();
|
||||
$("#g-server-add-add-button", this.element).show();
|
||||
$("#g-server-add-pause-button", this.element).hide();
|
||||
$("#g-server-add-continue-button", this.element).hide();
|
||||
$("#g-videos-progress", this.element).slideUp();
|
||||
$("#g-videos-add-button", this.element).show();
|
||||
$("#g-videos-pause-button", this.element).hide();
|
||||
$("#g-videos-continue-button", this.element).hide();
|
||||
} else {
|
||||
if (!self.pause) {
|
||||
setTimeout(function() { self.run_add(); }, 25);
|
||||
|
@ -99,11 +104,11 @@
|
|||
$.ajax({
|
||||
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
||||
success: function(data, textStatus) {
|
||||
$("#g-server-add-tree", self.element).html(data);
|
||||
$("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
|
||||
$("#g-videos-tree", self.element).html(data);
|
||||
$("#g-videos-tree span.g-directory", self.element).dblclick(function(event) {
|
||||
self.open_dir(event);
|
||||
});
|
||||
$("#g-server-add-tree span.g-file, #g-server-add-tree span.g-directory", this.element).click(function(event) {
|
||||
$("#g-videos-tree span.g-file, #g-videos-tree span.g-directory", this.element).click(function(event) {
|
||||
self.select_file(event);
|
||||
});
|
||||
}
|
||||
|
@ -115,10 +120,10 @@
|
|||
*/
|
||||
select_file: function (event) {
|
||||
$(event.target).toggleClass("selected");
|
||||
if ($("#g-server-add span.selected").length) {
|
||||
$("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
|
||||
if ($("#g-videos span.selected").length) {
|
||||
$("#g-videos-add-button").enable(true).removeClass("ui-state-disabled");
|
||||
} else {
|
||||
$("#g-server-add-add-button").enable(false).addClass("ui-state-disabled");
|
||||
$("#g-videos-add-button").enable(false).addClass("ui-state-disabled");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
8
3.1/modules/videos/js/videos_download.js
Normal file
8
3.1/modules/videos/js/videos_download.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* rWatcher Edit: This file is one of mine.
|
||||
*
|
||||
*/
|
||||
$("document").ready(function() {
|
||||
var original_url = document.getElementById('g-videos-full-url');
|
||||
$("#g-movie").replaceWith("<div id=\"g-movie\" class=\"ui-helper-clearfix\"><center><a href=\"" + original_url.href + "\">Click Here to Download Video.</a></center></div>");
|
||||
});
|
1030
3.1/modules/videos/models/item.php
Normal file
1030
3.1/modules/videos/models/item.php
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -18,5 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
// rWatcher Note: This file is mine.
|
||||
class Items_video_Model extends ORM {
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,5 +17,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Videos_File_Model extends ORM {
|
||||
|
||||
// rWatcher Edit: This file used to be server_add_entry.php.
|
||||
class Videos_Entry_Model_Core extends ORM {
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
name = "Videos"
|
||||
description = "Allows authorized users to load videos directly from your web server"
|
||||
version = 1
|
||||
version = 4
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be admin_server_add.html.php ?>
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Add videos from server administration") ?> </h1>
|
||||
<div class="g-block-content">
|
||||
<?= $form ?>
|
||||
<h2><?= t("Authorized paths") ?></h2>
|
||||
<ul id="g-server-add-paths">
|
||||
<ul id="g-videos-paths">
|
||||
<? if (empty($paths)): ?>
|
||||
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
||||
<? endif ?>
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?
|
||||
// rWatcher Edit: This is a combination of Gallery's movieplayer.html.php file and
|
||||
// some custom edits.
|
||||
|
||||
$items_video = ORM::factory("items_video")
|
||||
->where("item_id", "=", $item->id)
|
||||
->find();
|
||||
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
||||
print html::anchor(str_replace("?m=", ".flv?m=", $item->resize_url(true)), "", $attrs);
|
||||
} else if ($items_video->loaded() && !(file_exists($item->resize_path() . ".flv"))) {
|
||||
print "<a href=\"" . $item->file_url(true) . "\" class=\"g-movie\" id=\"g-videos-full-url\"></a>";
|
||||
} else {
|
||||
print html::anchor($item->file_url(true), "", $attrs);
|
||||
}
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
|
||||
<? if (!file_exists($item->resize_path() . ".flv")) { ?>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$("#g-movie").replaceWith("<center><a href=\"<?= $item->file_url(true) ?>\">Click Here to Download Video.</a></center>");
|
||||
});
|
||||
</script>
|
||||
<? } ?>
|
|
@ -1,4 +1,5 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be server_add_tree.html.php ?>
|
||||
<li class="ui-icon-left">
|
||||
<span class="ui-icon ui-icon-folder-open"></span>
|
||||
<span class="g-directory" ref="">
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // rWatcher Edit: This file used to be server_add_tree_dialog.html.php, server_add has been replaced with videos ?>
|
||||
<script type="text/javascript">
|
||||
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
||||
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
||||
</script>
|
||||
|
||||
<div id="g-server-add">
|
||||
<h1 style="display: none;"><?= t("Add Videos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
||||
<div id="g-videos">
|
||||
<h1 style="display: none;"><?= t("Add Photos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
||||
|
||||
<p id="g-description"><?= t("Videos will be added to album:") ?></p>
|
||||
<p id="g-description"><?= t("Photos will be added to album:") ?></p>
|
||||
<ul class="g-breadcrumbs">
|
||||
<? $i = 0 ?>
|
||||
<? foreach ($item->parents() as $parent): ?>
|
||||
|
@ -17,35 +18,35 @@
|
|||
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
||||
</ul>
|
||||
|
||||
<ul id="g-server-add-tree" class="g-checkbox-tree">
|
||||
<ul id="g-videos-tree" class="g-checkbox-tree">
|
||||
<?= $tree ?>
|
||||
</ul>
|
||||
|
||||
<div id="g-server-add-progress" style="display: none">
|
||||
<div id="g-videos-progress" style="display: none">
|
||||
<div class="g-progress-bar"></div>
|
||||
<div id="g-status"></div>
|
||||
</div>
|
||||
|
||||
<span>
|
||||
<button id="g-server-add-add-button" class="ui-state-default ui-state-disabled ui-corner-all"
|
||||
<button id="g-videos-add-button" class="ui-state-default ui-state-disabled ui-corner-all"
|
||||
disabled="disabled">
|
||||
<?= t("Add") ?>
|
||||
</button>
|
||||
<button id="g-server-add-pause-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<button id="g-videos-pause-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<?= t("Pause") ?>
|
||||
</button>
|
||||
<button id="g-server-add-continue-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<button id="g-videos-continue-button" class="ui-state-default ui-corner-all" style="display:none">
|
||||
<?= t("Continue") ?>
|
||||
</button>
|
||||
|
||||
<button id="g-server-add-close-button" class="ui-state-default ui-corner-all">
|
||||
<button id="g-videos-close-button" class="ui-state-default ui-corner-all">
|
||||
<?= t("Close") ?>
|
||||
</button>
|
||||
</span>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#g-server-add").ready(function() {
|
||||
$("#g-server-add").gallery_server_add();
|
||||
$("#g-videos").ready(function() {
|
||||
$("#g-videos").gallery_videos();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Reference in New Issue
Block a user