Complete re-write for Gallery 3.0.1 compatability.
This commit is contained in:
parent
30d9551dab
commit
e2dc311221
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class Admin_Videos_Controller extends Admin_Controller {
|
||||||
public function index() {
|
public function index() {
|
||||||
$view = new Admin_View("admin.html");
|
$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 = new View("admin_videos.html");
|
||||||
$view->content->form = $this->_get_admin_form();
|
$view->content->form = $this->_get_admin_form();
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}"));
|
$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.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class Videos_Controller extends Admin_Controller {
|
||||||
public function browse($id) {
|
public function browse($id) {
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||||
@ -24,6 +30,12 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
$files[] = $path;
|
$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);
|
$item = ORM::factory("item", $id);
|
||||||
$view = new View("videos_tree_dialog.html");
|
$view = new View("videos_tree_dialog.html");
|
||||||
$view->item = $item;
|
$view->item = $item;
|
||||||
@ -55,6 +67,7 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
if (!is_dir($file)) {
|
if (!is_dir($file)) {
|
||||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||||
|
// rWatcher Edit
|
||||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
||||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||||
continue;
|
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() {
|
public function start() {
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
$item = ORM::factory("item", Input::instance()->get("item_id"));
|
$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()
|
$task_def = Task_Definition::factory()
|
||||||
->callback("Videos_Controller::add")
|
->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"));
|
->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(
|
json::reply(
|
||||||
array("result" => "started",
|
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) {
|
function run($task_id) {
|
||||||
access::verify_csrf();
|
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
|
* 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.
|
* them one at a time.
|
||||||
*/
|
*/
|
||||||
static function add($task) {
|
static function add($task) {
|
||||||
@ -129,6 +147,7 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case "init":
|
case "init":
|
||||||
$task->set("mode", "build-file-list");
|
$task->set("mode", "build-file-list");
|
||||||
|
$task->set("dirs_scanned", 0);
|
||||||
$task->percent_complete = 0;
|
$task->percent_complete = 0;
|
||||||
$task->status = t("Starting up");
|
$task->status = t("Starting up");
|
||||||
batch::start();
|
batch::start();
|
||||||
@ -137,59 +156,64 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
case "build-file-list": // 0% to 10%
|
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.
|
// 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
|
// 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
|
// with a deep hierarchy and we don't want to go over our time quota.
|
||||||
// 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");
|
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
$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) {
|
if ($entry->loaded()) {
|
||||||
list($file, $parent_entry_id) = array_shift($queue);
|
$child_paths = glob(preg_quote($entry->path) . "/*");
|
||||||
// Ignore the staging directories as directories to be imported.
|
if (!$child_paths) {
|
||||||
if (empty($paths[$file])) {
|
$child_paths = glob("{$entry->path}/*");
|
||||||
$entry = ORM::factory("videos_file");
|
}
|
||||||
$entry->task_id = $task->id;
|
foreach ($child_paths as $child_path) {
|
||||||
$entry->file = $file;
|
if (!is_dir($child_path)) {
|
||||||
$entry->parent_id = $parent_entry_id;
|
$ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION));
|
||||||
$entry->save();
|
// rWatcher Edit.
|
||||||
$entry_id = $entry->id;
|
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) ||
|
||||||
} else {
|
// !filesize($child_path)) {
|
||||||
$entry_id = null;
|
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) ||
|
||||||
|
!filesize($child_path)) {
|
||||||
|
// Not importable, skip it.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = preg_quote($file);
|
$child_entry = ORM::factory("videos_entry");
|
||||||
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->task_id = $task->id;
|
||||||
$child_entry->file = $child;
|
$child_entry->path = $child_path;
|
||||||
$child_entry->parent_id = $entry_id;
|
$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();
|
$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
|
// 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
|
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
|
||||||
// over 10% in percent_complete.
|
// 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->percent_complete = min($task->percent_complete + 0.1, 10);
|
||||||
$task->status = t2(
|
$task->status = t2("Scanned one directory", "Scanned %count directories", $dirs_scanned);
|
||||||
"Found one file", "Found %count files",
|
|
||||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
|
||||||
|
|
||||||
if (!$queue) {
|
if (!$entry->loaded()) {
|
||||||
$task->set("mode", "add-files");
|
$task->set("mode", "add-files");
|
||||||
$task->set(
|
$task->set(
|
||||||
"total_files",
|
"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;
|
$task->percent_complete = 10;
|
||||||
}
|
}
|
||||||
break;
|
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
|
// 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,
|
// will create albums first. Ignore entries which already have an Item_Model attached,
|
||||||
// they're done.
|
// they're done.
|
||||||
$entries = ORM::factory("videos_file")
|
$entries = ORM::factory("videos_entry")
|
||||||
->where("task_id", "=", $task->id)
|
->where("task_id", "=", $task->id)
|
||||||
->where("item_id", "IS", null)
|
->where("item_id", "IS", null)
|
||||||
->order_by("id", "ASC")
|
->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
|
// 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.
|
// 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()) {
|
if (!$parent_entry->loaded()) {
|
||||||
$parent = ORM::factory("item", $task->get("item_id"));
|
$parent = ORM::factory("item", $task->get("item_id"));
|
||||||
} else {
|
} else {
|
||||||
$parent = ORM::factory("item", $parent_entry->item_id);
|
$parent = ORM::factory("item", $parent_entry->item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = basename($entry->file);
|
$name = basename($entry->path);
|
||||||
$title = item::convert_filename_to_title($name);
|
$title = item::convert_filename_to_title($name);
|
||||||
if (is_dir($entry->file)) {
|
if ($entry->is_directory) {
|
||||||
$album = ORM::factory("item");
|
$album = ORM::factory("item");
|
||||||
$album->type = "album";
|
$album->type = "album";
|
||||||
$album->parent_id = $parent->id;
|
$album->parent_id = $parent->id;
|
||||||
$album->name = $name;
|
$album->name = $name;
|
||||||
$album->title = $title;
|
$album->title = $title;
|
||||||
$album->owner_id = $owner_id;
|
$album->owner_id = $owner_id;
|
||||||
|
$album->sort_order = $parent->sort_order;
|
||||||
|
$album->sort_column = $parent->sort_column;
|
||||||
$album->save();
|
$album->save();
|
||||||
$entry->item_id = $album->id;
|
$entry->item_id = $album->id;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
$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 = ORM::factory("item");
|
||||||
$movie->type = "movie";
|
$movie->type = "movie";
|
||||||
$movie->parent_id = $parent->id;
|
$movie->parent_id = $parent->id;
|
||||||
$movie->set_data_file($entry->file);
|
$movie->set_data_file($entry->path);
|
||||||
$movie->name = $name;
|
$movie->name = $name;
|
||||||
$movie->title = $title;
|
$movie->title = $title;
|
||||||
$movie->owner_id = $owner_id;
|
$movie->owner_id = $owner_id;
|
||||||
$movie->save();
|
$movie->save();
|
||||||
$entry->item_id = $movie->id;
|
$entry->item_id = $movie->id;
|
||||||
|
// rWatcher EDIT: Add record to items_video db.
|
||||||
$items_video = ORM::factory("items_video");
|
$items_video = ORM::factory("items_video");
|
||||||
$items_video->item_id = $movie->id;
|
$items_video->item_id = $movie->id;
|
||||||
$items_video->save();
|
$items_video->save();
|
||||||
if (file_exists($entry->file . ".flv")) {
|
// rWatcher EDIT: Scan for flv resizes and copy to resize directory.
|
||||||
copy($entry->file . ".flv", $movie->resize_path() . ".flv");
|
if (file_exists($entry->path . ".flv")) {
|
||||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->file . ".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->height = $vid_height;
|
||||||
$movie->width = $vid_width;
|
$movie->width = $vid_width;
|
||||||
$movie->save();
|
$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
|
// process. But just in, case.. set this to a non-null value so that we skip this
|
||||||
// entry.
|
// entry.
|
||||||
$entry->item_id = 0;
|
$entry->item_id = 0;
|
||||||
$task->log("Skipping unknown file type: $entry->file");
|
$task->log("Skipping unknown file type: {$entry->path}");
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
||||||
$entry->item_id = 0;
|
$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->done = true;
|
||||||
$task->state = "success";
|
$task->state = "success";
|
||||||
$task->percent_complete = 100;
|
$task->percent_complete = 100;
|
||||||
db::build()
|
ORM::factory("videos_entry")
|
||||||
->delete("videos_files")
|
|
||||||
->where("task_id", "=", $task->id)
|
->where("task_id", "=", $task->id)
|
||||||
->execute();
|
->delete_all();
|
||||||
message::info(t2("Successfully added one file",
|
message::info(t2("Successfully added one photo / album",
|
||||||
"Successfully added %count files",
|
"Successfully added %count photos / albums",
|
||||||
$task->get("completed_files")));
|
$task->get("completed_files")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
#g-server-add button {
|
#g-videos button {
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree {
|
#g-videos-tree {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree li {
|
#g-videos-tree li {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree span.selected {
|
#g-videos-tree span.selected {
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree {
|
#g-videos-tree {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
height: 20em;
|
height: 20em;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -25,14 +25,14 @@
|
|||||||
padding: .5em;
|
padding: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add ul ul li {
|
#g-videos ul ul li {
|
||||||
padding-left: 1.2em;
|
padding-left: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-paths li .ui-icon {
|
#g-videos-paths li .ui-icon {
|
||||||
margin-top: .4em;
|
margin-top: .4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-admin-form .textbox {
|
#g-videos-admin-form .textbox {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_Core {
|
||||||
static function check_config($paths=null) {
|
static function check_config($paths=null) {
|
||||||
if ($paths === null) {
|
if ($paths === null) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_event_Core {
|
||||||
static function admin_menu($menu, $theme) {
|
static function admin_menu($menu, $theme) {
|
||||||
$menu->get("settings_menu")
|
$menu->get("settings_menu")
|
||||||
@ -34,7 +38,7 @@ class videos_event_Core {
|
|||||||
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
||||||
$menu->get("add_menu")
|
$menu->get("add_menu")
|
||||||
->append(Menu::factory("dialog")
|
->append(Menu::factory("dialog")
|
||||||
->id("videos")
|
->id("Videos")
|
||||||
->label(t("Add videos"))
|
->label(t("Add videos"))
|
||||||
->url(url::site("videos/browse/$item->id")));
|
->url(url::site("videos/browse/$item->id")));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_installer {
|
||||||
static function install() {
|
static function install() {
|
||||||
$db = Database::instance();
|
$db = Database::instance();
|
||||||
$db->query("CREATE TABLE {videos_files} (
|
$db->query("CREATE TABLE {videos_entries} (
|
||||||
`id` int(9) NOT NULL auto_increment,
|
`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),
|
`item_id` int(9),
|
||||||
`parent_id` int(9),
|
`parent_id` int(9),
|
||||||
|
`path` varchar(255) NOT NULL,
|
||||||
`task_id` int(9) NOT NULL,
|
`task_id` int(9) NOT NULL,
|
||||||
PRIMARY KEY (`id`))
|
PRIMARY KEY (`id`))
|
||||||
DEFAULT CHARSET=utf8;");
|
DEFAULT CHARSET=utf8;");
|
||||||
|
|
||||||
|
// rWatcher Edit: My Table.
|
||||||
$db->query("CREATE TABLE {items_videos} (
|
$db->query("CREATE TABLE {items_videos} (
|
||||||
`id` int(9) NOT NULL auto_increment,
|
`id` int(9) NOT NULL auto_increment,
|
||||||
`item_id` int(9) NOT NULL,
|
`item_id` int(9) NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY (`item_id`, `id`))
|
KEY (`item_id`, `id`))
|
||||||
DEFAULT CHARSET=utf8;");
|
DEFAULT CHARSET=utf8;");
|
||||||
|
// rWatcher Edit: My Variable.
|
||||||
module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts")));
|
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();
|
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() {
|
static function deactivate() {
|
||||||
site_status::clear("videos_configuration");
|
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.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_theme_Core {
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
$buf = "";
|
$buf = "";
|
||||||
@ -30,25 +36,24 @@ class videos_theme_Core {
|
|||||||
$items_video = ORM::factory("items_video")
|
$items_video = ORM::factory("items_video")
|
||||||
->where("item_id", "=", $item->id)
|
->where("item_id", "=", $item->id)
|
||||||
->find();
|
->find();
|
||||||
if ($items_video->loaded()) {
|
if (($items_video->loaded()) && (!file_exists($item->resize_path() . ".flv"))) {
|
||||||
$view = new View("videos_display_js.html");
|
$buf .= $theme->script("videos_download.js");
|
||||||
//$view->embed_code = addslashes($embedded_video->embed_code);
|
|
||||||
return $buf . $view;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function admin_head($theme) {
|
static function admin_head($theme) {
|
||||||
$buf = "";
|
$buf = "";
|
||||||
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
||||||
$buf .= $theme->css("videos.css");
|
$buf .= $theme->css("videos.css")
|
||||||
$buf .= $theme->css("jquery.autocomplete.css");
|
. $theme->css("jquery.autocomplete.css");
|
||||||
$base = url::site("__ARGS__");
|
$base = url::site("__ARGS__");
|
||||||
$csrf = access::csrf_token();
|
$csrf = access::csrf_token();
|
||||||
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
||||||
|
|
||||||
$buf .= $theme->script("jquery.autocomplete.js");
|
$buf .= $theme->script("jquery.autocomplete.js")
|
||||||
$buf .= $theme->script("admin_videos.js");
|
. $theme->script("admin_videos.js"); // rWatcher edit.
|
||||||
}
|
}
|
||||||
|
|
||||||
return $buf;
|
return $buf;
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
* Set up autocomplete on the server path list
|
* 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() {
|
$("document").ready(function() {
|
||||||
$("#g-path").autocomplete(
|
$("#g-path").autocomplete(
|
||||||
base_url.replace("__ARGS__", "admin/videos/autocomplete"), {max: 256});
|
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($) {
|
(function($) {
|
||||||
$.widget("ui.gallery_server_add", {
|
$.widget("ui.gallery_videos", {
|
||||||
_init: function() {
|
_init: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$("#g-server-add-add-button", this.element).click(function(event) {
|
$("#g-videos-add-button", this.element).click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(".g-progress-bar", this.element).
|
$(".g-progress-bar", this.element).
|
||||||
progressbar().
|
progressbar().
|
||||||
progressbar("value", 0);
|
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;
|
self.pause = true;
|
||||||
$("#g-server-add-pause-button", this.element).hide();
|
$("#g-videos-pause-button", this.element).hide();
|
||||||
$("#g-server-add-continue-button", this.element).show();
|
$("#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;
|
self.pause = false;
|
||||||
$("#g-server-add-pause-button", this.element).show();
|
$("#g-videos-pause-button", this.element).show();
|
||||||
$("#g-server-add-continue-button", this.element).hide();
|
$("#g-videos-continue-button", this.element).hide();
|
||||||
self.run_add();
|
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");
|
$("#g-dialog").dialog("close");
|
||||||
window.location.reload();
|
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);
|
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);
|
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);
|
self.open_dir(event);
|
||||||
});
|
});
|
||||||
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
||||||
@ -48,8 +53,8 @@
|
|||||||
paths.push($(this).attr("ref"));
|
paths.push($(this).attr("ref"));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#g-server-add-add-button", this.element).hide();
|
$("#g-videos-add-button", this.element).hide();
|
||||||
$("#g-server-add-pause-button", this.element).show();
|
$("#g-videos-pause-button", this.element).show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: START_URL,
|
url: START_URL,
|
||||||
@ -77,10 +82,10 @@
|
|||||||
$("#g-status").html(data.status);
|
$("#g-status").html(data.status);
|
||||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||||
if (data.done) {
|
if (data.done) {
|
||||||
$("#g-server-add-progress", this.element).slideUp();
|
$("#g-videos-progress", this.element).slideUp();
|
||||||
$("#g-server-add-add-button", this.element).show();
|
$("#g-videos-add-button", this.element).show();
|
||||||
$("#g-server-add-pause-button", this.element).hide();
|
$("#g-videos-pause-button", this.element).hide();
|
||||||
$("#g-server-add-continue-button", this.element).hide();
|
$("#g-videos-continue-button", this.element).hide();
|
||||||
} else {
|
} else {
|
||||||
if (!self.pause) {
|
if (!self.pause) {
|
||||||
setTimeout(function() { self.run_add(); }, 25);
|
setTimeout(function() { self.run_add(); }, 25);
|
||||||
@ -99,11 +104,11 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
||||||
success: function(data, textStatus) {
|
success: function(data, textStatus) {
|
||||||
$("#g-server-add-tree", self.element).html(data);
|
$("#g-videos-tree", self.element).html(data);
|
||||||
$("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
|
$("#g-videos-tree span.g-directory", self.element).dblclick(function(event) {
|
||||||
self.open_dir(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);
|
self.select_file(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,10 +120,10 @@
|
|||||||
*/
|
*/
|
||||||
select_file: function (event) {
|
select_file: function (event) {
|
||||||
$(event.target).toggleClass("selected");
|
$(event.target).toggleClass("selected");
|
||||||
if ($("#g-server-add span.selected").length) {
|
if ($("#g-videos span.selected").length) {
|
||||||
$("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
|
$("#g-videos-add-button").enable(true).removeClass("ui-state-disabled");
|
||||||
} else {
|
} 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.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// rWatcher Note: This file is mine.
|
||||||
class Items_video_Model extends ORM {
|
class Items_video_Model extends ORM {
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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"
|
name = "Videos"
|
||||||
description = "Allows authorized users to load videos directly from your web server"
|
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.") ?>
|
<?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">
|
<div class="g-block">
|
||||||
<h1> <?= t("Add videos from server administration") ?> </h1>
|
<h1> <?= t("Add videos from server administration") ?> </h1>
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
<?= $form ?>
|
<?= $form ?>
|
||||||
<h2><?= t("Authorized paths") ?></h2>
|
<h2><?= t("Authorized paths") ?></h2>
|
||||||
<ul id="g-server-add-paths">
|
<ul id="g-videos-paths">
|
||||||
<? if (empty($paths)): ?>
|
<? if (empty($paths)): ?>
|
||||||
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?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")
|
$items_video = ORM::factory("items_video")
|
||||||
->where("item_id", "=", $item->id)
|
->where("item_id", "=", $item->id)
|
||||||
->find();
|
->find();
|
||||||
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
||||||
print html::anchor(str_replace("?m=", ".flv?m=", $item->resize_url(true)), "", $attrs);
|
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 {
|
} else {
|
||||||
print html::anchor($item->file_url(true), "", $attrs);
|
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.") ?>
|
<?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">
|
<li class="ui-icon-left">
|
||||||
<span class="ui-icon ui-icon-folder-open"></span>
|
<span class="ui-icon ui-icon-folder-open"></span>
|
||||||
<span class="g-directory" ref="">
|
<span class="g-directory" ref="">
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?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">
|
<script type="text/javascript">
|
||||||
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
||||||
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="g-server-add">
|
<div id="g-videos">
|
||||||
<h1 style="display: none;"><?= t("Add Videos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
<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">
|
<ul class="g-breadcrumbs">
|
||||||
<? $i = 0 ?>
|
<? $i = 0 ?>
|
||||||
<? foreach ($item->parents() as $parent): ?>
|
<? foreach ($item->parents() as $parent): ?>
|
||||||
@ -17,35 +18,35 @@
|
|||||||
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="g-server-add-tree" class="g-checkbox-tree">
|
<ul id="g-videos-tree" class="g-checkbox-tree">
|
||||||
<?= $tree ?>
|
<?= $tree ?>
|
||||||
</ul>
|
</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 class="g-progress-bar"></div>
|
||||||
<div id="g-status"></div>
|
<div id="g-status"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>
|
<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">
|
disabled="disabled">
|
||||||
<?= t("Add") ?>
|
<?= t("Add") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Pause") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Continue") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Close") ?>
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#g-server-add").ready(function() {
|
$("#g-videos").ready(function() {
|
||||||
$("#g-server-add").gallery_server_add();
|
$("#g-videos").gallery_videos();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class Admin_Videos_Controller extends Admin_Controller {
|
||||||
public function index() {
|
public function index() {
|
||||||
$view = new Admin_View("admin.html");
|
$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 = new View("admin_videos.html");
|
||||||
$view->content->form = $this->_get_admin_form();
|
$view->content->form = $this->_get_admin_form();
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths", "a:0:{}"));
|
$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.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class Videos_Controller extends Admin_Controller {
|
||||||
public function browse($id) {
|
public function browse($id) {
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
||||||
@ -24,6 +30,12 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
$files[] = $path;
|
$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);
|
$item = ORM::factory("item", $id);
|
||||||
$view = new View("videos_tree_dialog.html");
|
$view = new View("videos_tree_dialog.html");
|
||||||
$view->item = $item;
|
$view->item = $item;
|
||||||
@ -55,6 +67,7 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
}
|
}
|
||||||
if (!is_dir($file)) {
|
if (!is_dir($file)) {
|
||||||
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
|
||||||
|
// rWatcher Edit
|
||||||
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v"))) {
|
||||||
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions")))) {
|
||||||
continue;
|
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() {
|
public function start() {
|
||||||
access::verify_csrf();
|
access::verify_csrf();
|
||||||
$item = ORM::factory("item", Input::instance()->get("item_id"));
|
$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()
|
$task_def = Task_Definition::factory()
|
||||||
->callback("Videos_Controller::add")
|
->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"));
|
->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(
|
json::reply(
|
||||||
array("result" => "started",
|
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) {
|
function run($task_id) {
|
||||||
access::verify_csrf();
|
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
|
* 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.
|
* them one at a time.
|
||||||
*/
|
*/
|
||||||
static function add($task) {
|
static function add($task) {
|
||||||
@ -129,6 +147,7 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case "init":
|
case "init":
|
||||||
$task->set("mode", "build-file-list");
|
$task->set("mode", "build-file-list");
|
||||||
|
$task->set("dirs_scanned", 0);
|
||||||
$task->percent_complete = 0;
|
$task->percent_complete = 0;
|
||||||
$task->status = t("Starting up");
|
$task->status = t("Starting up");
|
||||||
batch::start();
|
batch::start();
|
||||||
@ -137,59 +156,64 @@ class Videos_Controller extends Admin_Controller {
|
|||||||
case "build-file-list": // 0% to 10%
|
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.
|
// 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
|
// 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
|
// with a deep hierarchy and we don't want to go over our time quota.
|
||||||
// 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");
|
|
||||||
$paths = unserialize(module::get_var("videos", "authorized_paths"));
|
$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) {
|
if ($entry->loaded()) {
|
||||||
list($file, $parent_entry_id) = array_shift($queue);
|
$child_paths = glob(preg_quote($entry->path) . "/*");
|
||||||
// Ignore the staging directories as directories to be imported.
|
if (!$child_paths) {
|
||||||
if (empty($paths[$file])) {
|
$child_paths = glob("{$entry->path}/*");
|
||||||
$entry = ORM::factory("videos_file");
|
}
|
||||||
$entry->task_id = $task->id;
|
foreach ($child_paths as $child_path) {
|
||||||
$entry->file = $file;
|
if (!is_dir($child_path)) {
|
||||||
$entry->parent_id = $parent_entry_id;
|
$ext = strtolower(pathinfo($child_path, PATHINFO_EXTENSION));
|
||||||
$entry->save();
|
// rWatcher Edit.
|
||||||
$entry_id = $entry->id;
|
//if (!in_array($ext, array("gif", "jpeg", "jpg", "png", "flv", "mp4", "m4v")) ||
|
||||||
} else {
|
// !filesize($child_path)) {
|
||||||
$entry_id = null;
|
if (!in_array($ext, unserialize(module::get_var("videos", "allowed_extensions"))) ||
|
||||||
|
!filesize($child_path)) {
|
||||||
|
// Not importable, skip it.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = preg_quote($file);
|
$child_entry = ORM::factory("videos_entry");
|
||||||
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->task_id = $task->id;
|
||||||
$child_entry->file = $child;
|
$child_entry->path = $child_path;
|
||||||
$child_entry->parent_id = $entry_id;
|
$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();
|
$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
|
// 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
|
// hierarchy rabbit hole goes. Leave ourselves room here for 100 iterations and don't go
|
||||||
// over 10% in percent_complete.
|
// 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->percent_complete = min($task->percent_complete + 0.1, 10);
|
||||||
$task->status = t2(
|
$task->status = t2("Scanned one directory", "Scanned %count directories", $dirs_scanned);
|
||||||
"Found one file", "Found %count files",
|
|
||||||
ORM::factory("videos_file")->where("task_id", "=", $task->id)->count_all());
|
|
||||||
|
|
||||||
if (!$queue) {
|
if (!$entry->loaded()) {
|
||||||
$task->set("mode", "add-files");
|
$task->set("mode", "add-files");
|
||||||
$task->set(
|
$task->set(
|
||||||
"total_files",
|
"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;
|
$task->percent_complete = 10;
|
||||||
}
|
}
|
||||||
break;
|
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
|
// 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,
|
// will create albums first. Ignore entries which already have an Item_Model attached,
|
||||||
// they're done.
|
// they're done.
|
||||||
$entries = ORM::factory("videos_file")
|
$entries = ORM::factory("videos_entry")
|
||||||
->where("task_id", "=", $task->id)
|
->where("task_id", "=", $task->id)
|
||||||
->where("item_id", "IS", null)
|
->where("item_id", "IS", null)
|
||||||
->order_by("id", "ASC")
|
->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
|
// 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.
|
// 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()) {
|
if (!$parent_entry->loaded()) {
|
||||||
$parent = ORM::factory("item", $task->get("item_id"));
|
$parent = ORM::factory("item", $task->get("item_id"));
|
||||||
} else {
|
} else {
|
||||||
$parent = ORM::factory("item", $parent_entry->item_id);
|
$parent = ORM::factory("item", $parent_entry->item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = basename($entry->file);
|
$name = basename($entry->path);
|
||||||
$title = item::convert_filename_to_title($name);
|
$title = item::convert_filename_to_title($name);
|
||||||
if (is_dir($entry->file)) {
|
if ($entry->is_directory) {
|
||||||
$album = ORM::factory("item");
|
$album = ORM::factory("item");
|
||||||
$album->type = "album";
|
$album->type = "album";
|
||||||
$album->parent_id = $parent->id;
|
$album->parent_id = $parent->id;
|
||||||
$album->name = $name;
|
$album->name = $name;
|
||||||
$album->title = $title;
|
$album->title = $title;
|
||||||
$album->owner_id = $owner_id;
|
$album->owner_id = $owner_id;
|
||||||
|
$album->sort_order = $parent->sort_order;
|
||||||
|
$album->sort_column = $parent->sort_column;
|
||||||
$album->save();
|
$album->save();
|
||||||
$entry->item_id = $album->id;
|
$entry->item_id = $album->id;
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$extension = strtolower(pathinfo($name, PATHINFO_EXTENSION));
|
$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 = ORM::factory("item");
|
||||||
$movie->type = "movie";
|
$movie->type = "movie";
|
||||||
$movie->parent_id = $parent->id;
|
$movie->parent_id = $parent->id;
|
||||||
$movie->set_data_file($entry->file);
|
$movie->set_data_file($entry->path);
|
||||||
$movie->name = $name;
|
$movie->name = $name;
|
||||||
$movie->title = $title;
|
$movie->title = $title;
|
||||||
$movie->owner_id = $owner_id;
|
$movie->owner_id = $owner_id;
|
||||||
$movie->save();
|
$movie->save();
|
||||||
$entry->item_id = $movie->id;
|
$entry->item_id = $movie->id;
|
||||||
|
// rWatcher EDIT: Add record to items_video db.
|
||||||
$items_video = ORM::factory("items_video");
|
$items_video = ORM::factory("items_video");
|
||||||
$items_video->item_id = $movie->id;
|
$items_video->item_id = $movie->id;
|
||||||
$items_video->save();
|
$items_video->save();
|
||||||
if (file_exists($entry->file . ".flv")) {
|
// rWatcher EDIT: Scan for flv resizes and copy to resize directory.
|
||||||
copy($entry->file . ".flv", $movie->resize_path() . ".flv");
|
if (file_exists($entry->path . ".flv")) {
|
||||||
list ($vid_width, $vid_height, $mime_type) = movie::get_file_metadata($entry->file . ".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->height = $vid_height;
|
||||||
$movie->width = $vid_width;
|
$movie->width = $vid_width;
|
||||||
$movie->save();
|
$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
|
// process. But just in, case.. set this to a non-null value so that we skip this
|
||||||
// entry.
|
// entry.
|
||||||
$entry->item_id = 0;
|
$entry->item_id = 0;
|
||||||
$task->log("Skipping unknown file type: $entry->file");
|
$task->log("Skipping unknown file type: {$entry->path}");
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
|
||||||
$entry->item_id = 0;
|
$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->done = true;
|
||||||
$task->state = "success";
|
$task->state = "success";
|
||||||
$task->percent_complete = 100;
|
$task->percent_complete = 100;
|
||||||
db::build()
|
ORM::factory("videos_entry")
|
||||||
->delete("videos_files")
|
|
||||||
->where("task_id", "=", $task->id)
|
->where("task_id", "=", $task->id)
|
||||||
->execute();
|
->delete_all();
|
||||||
message::info(t2("Successfully added one file",
|
message::info(t2("Successfully added one photo / album",
|
||||||
"Successfully added %count files",
|
"Successfully added %count photos / albums",
|
||||||
$task->get("completed_files")));
|
$task->get("completed_files")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
#g-server-add button {
|
#g-videos button {
|
||||||
margin-bottom: .5em;
|
margin-bottom: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree {
|
#g-videos-tree {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree li {
|
#g-videos-tree li {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
float: none;
|
float: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree span.selected {
|
#g-videos-tree span.selected {
|
||||||
background: #ddd;
|
background: #ddd;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-tree {
|
#g-videos-tree {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
height: 20em;
|
height: 20em;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -25,14 +25,14 @@
|
|||||||
padding: .5em;
|
padding: .5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add ul ul li {
|
#g-videos ul ul li {
|
||||||
padding-left: 1.2em;
|
padding-left: 1.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-paths li .ui-icon {
|
#g-videos-paths li .ui-icon {
|
||||||
margin-top: .4em;
|
margin-top: .4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#g-server-add-admin-form .textbox {
|
#g-videos-admin-form .textbox {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_Core {
|
||||||
static function check_config($paths=null) {
|
static function check_config($paths=null) {
|
||||||
if ($paths === null) {
|
if ($paths === null) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_event_Core {
|
||||||
static function admin_menu($menu, $theme) {
|
static function admin_menu($menu, $theme) {
|
||||||
$menu->get("settings_menu")
|
$menu->get("settings_menu")
|
||||||
@ -34,7 +38,7 @@ class videos_event_Core {
|
|||||||
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
is_writable($item->is_album() ? $item->file_path() : $item->parent()->file_path())) {
|
||||||
$menu->get("add_menu")
|
$menu->get("add_menu")
|
||||||
->append(Menu::factory("dialog")
|
->append(Menu::factory("dialog")
|
||||||
->id("videos")
|
->id("Videos")
|
||||||
->label(t("Add videos"))
|
->label(t("Add videos"))
|
||||||
->url(url::site("videos/browse/$item->id")));
|
->url(url::site("videos/browse/$item->id")));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_installer {
|
||||||
static function install() {
|
static function install() {
|
||||||
$db = Database::instance();
|
$db = Database::instance();
|
||||||
$db->query("CREATE TABLE {videos_files} (
|
$db->query("CREATE TABLE {videos_entries} (
|
||||||
`id` int(9) NOT NULL auto_increment,
|
`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),
|
`item_id` int(9),
|
||||||
`parent_id` int(9),
|
`parent_id` int(9),
|
||||||
|
`path` varchar(255) NOT NULL,
|
||||||
`task_id` int(9) NOT NULL,
|
`task_id` int(9) NOT NULL,
|
||||||
PRIMARY KEY (`id`))
|
PRIMARY KEY (`id`))
|
||||||
DEFAULT CHARSET=utf8;");
|
DEFAULT CHARSET=utf8;");
|
||||||
|
|
||||||
|
// rWatcher Edit: My Table.
|
||||||
$db->query("CREATE TABLE {items_videos} (
|
$db->query("CREATE TABLE {items_videos} (
|
||||||
`id` int(9) NOT NULL auto_increment,
|
`id` int(9) NOT NULL auto_increment,
|
||||||
`item_id` int(9) NOT NULL,
|
`item_id` int(9) NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY (`item_id`, `id`))
|
KEY (`item_id`, `id`))
|
||||||
DEFAULT CHARSET=utf8;");
|
DEFAULT CHARSET=utf8;");
|
||||||
|
// rWatcher Edit: My Variable.
|
||||||
module::set_var("videos", "allowed_extensions", serialize(array("avi", "mpg", "mpeg", "mov", "wmv", "asf", "mts")));
|
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();
|
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() {
|
static function deactivate() {
|
||||||
site_status::clear("videos_configuration");
|
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.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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 {
|
class videos_theme_Core {
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
$buf = "";
|
$buf = "";
|
||||||
@ -30,25 +36,24 @@ class videos_theme_Core {
|
|||||||
$items_video = ORM::factory("items_video")
|
$items_video = ORM::factory("items_video")
|
||||||
->where("item_id", "=", $item->id)
|
->where("item_id", "=", $item->id)
|
||||||
->find();
|
->find();
|
||||||
if ($items_video->loaded()) {
|
if (($items_video->loaded()) && (!file_exists($item->resize_path() . ".flv"))) {
|
||||||
$view = new View("videos_display_js.html");
|
$buf .= $theme->script("videos_download.js");
|
||||||
//$view->embed_code = addslashes($embedded_video->embed_code);
|
|
||||||
return $buf . $view;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return $buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function admin_head($theme) {
|
static function admin_head($theme) {
|
||||||
$buf = "";
|
$buf = "";
|
||||||
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
if (strpos(Router::$current_uri, "admin/videos") !== false) {
|
||||||
$buf .= $theme->css("videos.css");
|
$buf .= $theme->css("videos.css")
|
||||||
$buf .= $theme->css("jquery.autocomplete.css");
|
. $theme->css("jquery.autocomplete.css");
|
||||||
$base = url::site("__ARGS__");
|
$base = url::site("__ARGS__");
|
||||||
$csrf = access::csrf_token();
|
$csrf = access::csrf_token();
|
||||||
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
$buf .= "<script type=\"text/javascript\"> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
|
||||||
|
|
||||||
$buf .= $theme->script("jquery.autocomplete.js");
|
$buf .= $theme->script("jquery.autocomplete.js")
|
||||||
$buf .= $theme->script("admin_videos.js");
|
. $theme->script("admin_videos.js"); // rWatcher edit.
|
||||||
}
|
}
|
||||||
|
|
||||||
return $buf;
|
return $buf;
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
* Set up autocomplete on the server path list
|
* 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() {
|
$("document").ready(function() {
|
||||||
$("#g-path").autocomplete(
|
$("#g-path").autocomplete(
|
||||||
base_url.replace("__ARGS__", "admin/videos/autocomplete"), {max: 256});
|
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($) {
|
(function($) {
|
||||||
$.widget("ui.gallery_server_add", {
|
$.widget("ui.gallery_videos", {
|
||||||
_init: function() {
|
_init: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
$("#g-server-add-add-button", this.element).click(function(event) {
|
$("#g-videos-add-button", this.element).click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(".g-progress-bar", this.element).
|
$(".g-progress-bar", this.element).
|
||||||
progressbar().
|
progressbar().
|
||||||
progressbar("value", 0);
|
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;
|
self.pause = true;
|
||||||
$("#g-server-add-pause-button", this.element).hide();
|
$("#g-videos-pause-button", this.element).hide();
|
||||||
$("#g-server-add-continue-button", this.element).show();
|
$("#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;
|
self.pause = false;
|
||||||
$("#g-server-add-pause-button", this.element).show();
|
$("#g-videos-pause-button", this.element).show();
|
||||||
$("#g-server-add-continue-button", this.element).hide();
|
$("#g-videos-continue-button", this.element).hide();
|
||||||
self.run_add();
|
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");
|
$("#g-dialog").dialog("close");
|
||||||
window.location.reload();
|
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);
|
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);
|
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);
|
self.open_dir(event);
|
||||||
});
|
});
|
||||||
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
$("#g-dialog").bind("dialogclose", function(event, ui) {
|
||||||
@ -48,8 +53,8 @@
|
|||||||
paths.push($(this).attr("ref"));
|
paths.push($(this).attr("ref"));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#g-server-add-add-button", this.element).hide();
|
$("#g-videos-add-button", this.element).hide();
|
||||||
$("#g-server-add-pause-button", this.element).show();
|
$("#g-videos-pause-button", this.element).show();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: START_URL,
|
url: START_URL,
|
||||||
@ -77,10 +82,10 @@
|
|||||||
$("#g-status").html(data.status);
|
$("#g-status").html(data.status);
|
||||||
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
$(".g-progress-bar", self.element).progressbar("value", data.percent_complete);
|
||||||
if (data.done) {
|
if (data.done) {
|
||||||
$("#g-server-add-progress", this.element).slideUp();
|
$("#g-videos-progress", this.element).slideUp();
|
||||||
$("#g-server-add-add-button", this.element).show();
|
$("#g-videos-add-button", this.element).show();
|
||||||
$("#g-server-add-pause-button", this.element).hide();
|
$("#g-videos-pause-button", this.element).hide();
|
||||||
$("#g-server-add-continue-button", this.element).hide();
|
$("#g-videos-continue-button", this.element).hide();
|
||||||
} else {
|
} else {
|
||||||
if (!self.pause) {
|
if (!self.pause) {
|
||||||
setTimeout(function() { self.run_add(); }, 25);
|
setTimeout(function() { self.run_add(); }, 25);
|
||||||
@ -99,11 +104,11 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
url: GET_CHILDREN_URL.replace("__PATH__", path),
|
||||||
success: function(data, textStatus) {
|
success: function(data, textStatus) {
|
||||||
$("#g-server-add-tree", self.element).html(data);
|
$("#g-videos-tree", self.element).html(data);
|
||||||
$("#g-server-add-tree span.g-directory", self.element).dblclick(function(event) {
|
$("#g-videos-tree span.g-directory", self.element).dblclick(function(event) {
|
||||||
self.open_dir(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);
|
self.select_file(event);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -115,10 +120,10 @@
|
|||||||
*/
|
*/
|
||||||
select_file: function (event) {
|
select_file: function (event) {
|
||||||
$(event.target).toggleClass("selected");
|
$(event.target).toggleClass("selected");
|
||||||
if ($("#g-server-add span.selected").length) {
|
if ($("#g-videos span.selected").length) {
|
||||||
$("#g-server-add-add-button").enable(true).removeClass("ui-state-disabled");
|
$("#g-videos-add-button").enable(true).removeClass("ui-state-disabled");
|
||||||
} else {
|
} 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.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// rWatcher Note: This file is mine.
|
||||||
class Items_video_Model extends ORM {
|
class Items_video_Model extends ORM {
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* 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
|
* 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
|
* 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
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* 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"
|
name = "Videos"
|
||||||
description = "Allows authorized users to load videos directly from your web server"
|
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.") ?>
|
<?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">
|
<div class="g-block">
|
||||||
<h1> <?= t("Add videos from server administration") ?> </h1>
|
<h1> <?= t("Add videos from server administration") ?> </h1>
|
||||||
<div class="g-block-content">
|
<div class="g-block-content">
|
||||||
<?= $form ?>
|
<?= $form ?>
|
||||||
<h2><?= t("Authorized paths") ?></h2>
|
<h2><?= t("Authorized paths") ?></h2>
|
||||||
<ul id="g-server-add-paths">
|
<ul id="g-videos-paths">
|
||||||
<? if (empty($paths)): ?>
|
<? if (empty($paths)): ?>
|
||||||
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
<li class="g-module-status g-info"><?= t("No authorized image source paths defined yet") ?></li>
|
||||||
<? endif ?>
|
<? endif ?>
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?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")
|
$items_video = ORM::factory("items_video")
|
||||||
->where("item_id", "=", $item->id)
|
->where("item_id", "=", $item->id)
|
||||||
->find();
|
->find();
|
||||||
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
if ($items_video->loaded() && file_exists($item->resize_path() . ".flv")) {
|
||||||
print html::anchor(str_replace("?m=", ".flv?m=", $item->resize_url(true)), "", $attrs);
|
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 {
|
} else {
|
||||||
print html::anchor($item->file_url(true), "", $attrs);
|
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.") ?>
|
<?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">
|
<li class="ui-icon-left">
|
||||||
<span class="ui-icon ui-icon-folder-open"></span>
|
<span class="ui-icon ui-icon-folder-open"></span>
|
||||||
<span class="g-directory" ref="">
|
<span class="g-directory" ref="">
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
<?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">
|
<script type="text/javascript">
|
||||||
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
var GET_CHILDREN_URL = "<?= url::site("videos/children?path=__PATH__") ?>";
|
||||||
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
var START_URL = "<?= url::site("videos/start?item_id={$item->id}&csrf=$csrf") ?>";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div id="g-server-add">
|
<div id="g-videos">
|
||||||
<h1 style="display: none;"><?= t("Add Videos to '%title'", array("title" => html::purify($item->title))) ?></h1>
|
<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">
|
<ul class="g-breadcrumbs">
|
||||||
<? $i = 0 ?>
|
<? $i = 0 ?>
|
||||||
<? foreach ($item->parents() as $parent): ?>
|
<? foreach ($item->parents() as $parent): ?>
|
||||||
@ -17,35 +18,35 @@
|
|||||||
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
<li class="g-active"> <?= html::purify($item->title) ?> </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul id="g-server-add-tree" class="g-checkbox-tree">
|
<ul id="g-videos-tree" class="g-checkbox-tree">
|
||||||
<?= $tree ?>
|
<?= $tree ?>
|
||||||
</ul>
|
</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 class="g-progress-bar"></div>
|
||||||
<div id="g-status"></div>
|
<div id="g-status"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span>
|
<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">
|
disabled="disabled">
|
||||||
<?= t("Add") ?>
|
<?= t("Add") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Pause") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Continue") ?>
|
||||||
</button>
|
</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") ?>
|
<?= t("Close") ?>
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$("#g-server-add").ready(function() {
|
$("#g-videos").ready(function() {
|
||||||
$("#g-server-add").gallery_server_add();
|
$("#g-videos").gallery_videos();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user