2009-07-09 01:36:56 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
|
|
|
/**
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2011-01-22 07:12:44 +00:00
|
|
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
2009-07-09 01:36:56 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
class EmbedLinks_Controller extends Controller {
|
2011-08-04 18:46:35 +00:00
|
|
|
public function showlinks($item_id) {
|
|
|
|
// Generate the Dialog Box for all HTML/BBCode/URLs available for $item.
|
|
|
|
$item = ORM::factory("item", $item_id);
|
|
|
|
access::required("view", $item);
|
|
|
|
$view = new View("embedlinks_alllinksdialog.html");
|
|
|
|
$view->item_id = $item_id;
|
|
|
|
print $view;
|
|
|
|
}
|
|
|
|
|
2009-07-09 01:36:56 +00:00
|
|
|
public function showhtml($item_id) {
|
2009-07-13 02:55:47 +00:00
|
|
|
// Generate the Dialog Box for HTML links.
|
2009-07-09 01:36:56 +00:00
|
|
|
$item = ORM::factory("item", $item_id);
|
|
|
|
access::required("view", $item);
|
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the current page is an album, only display two links.
|
2009-07-09 01:36:56 +00:00
|
|
|
if ($item->is_album()) {
|
|
|
|
$linkArray[0] = array("Text:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . "">Click Here</a>");
|
|
|
|
$linkArray[1] = array("Thumbnail:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkTitles[0] = array("Link To This Album:", 2);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the item is a movie, don't display resize links, do display an embed link.
|
|
|
|
} elseif ($item->is_movie()) {
|
|
|
|
// Link to the current page.
|
|
|
|
$linkArray[0] = array("Text:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . "">Click Here</a>");
|
|
|
|
$linkArray[1] = array("Thumbnail:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
|
|
|
$linkTitles[0] = array("Link To This Page:", 2);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display links to it.
|
|
|
|
if (access::can("view_full", $item)) {
|
|
|
|
$linkArray[2] = array("Text:", "<a href="" . $item->file_url(true) . "">Click Here</a>");
|
|
|
|
$linkArray[3] = array("Thumbnail:", "<a href="" . $item->file_url(true) . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
2011-08-05 05:43:35 +00:00
|
|
|
|
|
|
|
// Figure out what the path of the .flv file is.
|
|
|
|
$str_movie_path = $item->file_url(true);
|
|
|
|
if (module::is_active("videos")) {
|
|
|
|
$items_video = ORM::factory("items_video")
|
|
|
|
->where("item_id", "=", $item->id)
|
|
|
|
->find();
|
|
|
|
if ($items_video->loaded()) {
|
|
|
|
if (file_exists($item->resize_path() . ".flv")) {
|
|
|
|
$str_movie_path = str_replace("?m=", ".flv?m=", $item->resize_url(true));
|
|
|
|
} else {
|
|
|
|
$str_movie_path = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($str_movie_path != "") {
|
|
|
|
$linkArray[4] = array("Embed:", "<object id="flowplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" .
|
|
|
|
"width="" . $item->width . "" height="" . $item->height . ""><param name="movie" value="" .
|
|
|
|
url::abs_file("lib/flowplayer.swf") . "" /><param name="flashvars" value='config={"clip":"" .
|
|
|
|
$str_movie_path . ""}' /><embed type="application/x-shockwave-flash" width="" . $item->width .
|
|
|
|
"" height="" . $item->height . "" src="" . url::abs_file("lib/flowplayer.swf") . "" flashvars=" .
|
|
|
|
"'config={"clip":"" . $str_movie_path . ""}'/></object>");
|
|
|
|
$linkTitles[1] = array("Link To The Video File:", 3);
|
|
|
|
} else {
|
|
|
|
$linkTitles[1] = array("Link To The Video File:", 2);
|
|
|
|
}
|
2009-08-25 00:47:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Or else assume the item is a photo.
|
2009-07-09 01:36:56 +00:00
|
|
|
} else {
|
2009-07-13 02:55:47 +00:00
|
|
|
// Link to the current page.
|
2009-07-09 01:36:56 +00:00
|
|
|
$linkArray[0] = array("Text:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . "">Click Here</a>");
|
|
|
|
$linkArray[1] = array("Thumbnail:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
|
|
|
$linkArray[2] = array("Resized:", "<a href="" . url::abs_site("{$item->type}s/{$item->id}") . ""><img src="" . $item->resize_url(true) . ""></a>");
|
|
|
|
$linkTitles[0] = array("Link To This Page:", 3);
|
|
|
|
|
2009-07-13 02:55:47 +00:00
|
|
|
// Link to the "resized" version of the current image.
|
2009-07-09 01:36:56 +00:00
|
|
|
$linkArray[3] = array("Text:", "<a href="" . $item->resize_url(true) . "">Click Here</a>");
|
|
|
|
$linkArray[4] = array("Thumbnail:", "<a href="" . $item->resize_url(true) . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
|
|
|
$linkArray[5] = array("Image:", "<img src="" . $item->resize_url(true) . "">");
|
|
|
|
$linkTitles[1] = array("Link To The Resized Image:", 3);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-07-13 02:55:47 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display links to it.
|
2009-07-09 01:36:56 +00:00
|
|
|
if (access::can("view_full", $item)) {
|
|
|
|
$linkArray[6] = array("Text:", "<a href="" . $item->file_url(true) . "">Click Here</a>");
|
|
|
|
$linkArray[7] = array("Thumbnail:", "<a href="" . $item->file_url(true) . ""><img src="" . $item->thumb_url(true) . ""></a>");
|
|
|
|
$linkArray[8] = array("Resized:", "<a href="" . $item->file_url(true) . ""><img src="" . $item->resize_url(true) . ""></a>");
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkTitles[2] = array("Link To The Full Size Image:", 3);
|
2009-07-09 01:36:56 +00:00
|
|
|
}
|
|
|
|
}
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-07-09 01:36:56 +00:00
|
|
|
$view = new View("embedlinks_htmldialog.html");
|
|
|
|
$view->titles = $linkTitles;
|
|
|
|
$view->details = $linkArray;
|
|
|
|
print $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function showbbcode($item_id) {
|
2009-07-13 02:55:47 +00:00
|
|
|
// Generate the Dialog Box for BBCode links.
|
2011-08-04 18:46:35 +00:00
|
|
|
$item = ORM::factory("item", $item_id);
|
2009-07-09 01:36:56 +00:00
|
|
|
access::required("view", $item);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the current page is an album, only display two links.
|
2009-07-09 01:36:56 +00:00
|
|
|
if ($item->is_album()) {
|
|
|
|
$linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]");
|
|
|
|
$linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkTitles[0] = array("Link To This Album:", 2);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the item is a movie, don't display resize links.
|
|
|
|
} elseif ($item->is_movie()) {
|
|
|
|
// Link to the current page.
|
|
|
|
$linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]");
|
|
|
|
$linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkTitles[0] = array("Link To This Page:", 2);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display links to it.
|
|
|
|
if (access::can("view_full", $item)) {
|
|
|
|
$linkArray[2] = array("Text:", "[url=" . $item->file_url(true) . "]Click Here[/url]");
|
|
|
|
$linkArray[3] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkTitles[1] = array("Link To The Video File:", 2);
|
|
|
|
}
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// Or else assume the item is a photo.
|
2009-07-09 01:36:56 +00:00
|
|
|
} else {
|
2009-07-13 02:55:47 +00:00
|
|
|
// Link to the current page.
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkArray[0] = array("Text:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "]Click Here[/url]");
|
2009-07-09 01:36:56 +00:00
|
|
|
$linkArray[1] = array("Thumbnail:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkArray[2] = array("Resized:", "[url=" . url::abs_site("{$item->type}s/{$item->id}") . "][img]" . $item->resize_url(true) . "[/img][/url]");
|
|
|
|
$linkTitles[0] = array("Link To This Page:", 3);
|
|
|
|
|
2009-07-13 02:55:47 +00:00
|
|
|
// Link to the "resized" version of the current image.
|
2009-07-09 01:36:56 +00:00
|
|
|
$linkArray[3] = array("Text:", "[url=" . $item->resize_url(true) . "]Click Here[/url]");
|
|
|
|
$linkArray[4] = array("Thumbnail:", "[url=" . $item->resize_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkArray[5] = array("Image:", "[img]" . $item->resize_url(true) . "[/img]");
|
|
|
|
$linkTitles[1] = array("Link To The Resized Image:", 3);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-07-13 02:55:47 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display links to it.
|
2009-07-09 01:36:56 +00:00
|
|
|
if (access::can("view_full", $item)) {
|
|
|
|
$linkArray[6] = array("Text:", "[url=" . $item->file_url(true) . "]Click Here[/url]");
|
|
|
|
$linkArray[7] = array("Thumbnail:", "[url=" . $item->file_url(true) . "][img]" . $item->thumb_url(true) . "[/img][/url]");
|
|
|
|
$linkArray[8] = array("Resized:", "[url=" . $item->file_url(true) . "][img]" . $item->resize_url(true) . "[/img][/url]");
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkTitles[2] = array("Link To The Full Size Image:", 3);
|
2009-07-09 01:36:56 +00:00
|
|
|
}
|
|
|
|
}
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-07-09 01:36:56 +00:00
|
|
|
$view = new View("embedlinks_bbcodedialog.html");
|
|
|
|
$view->titles = $linkTitles;
|
|
|
|
$view->details = $linkArray;
|
|
|
|
print $view;
|
|
|
|
}
|
2009-08-02 19:11:07 +00:00
|
|
|
|
|
|
|
public function showfullurl($item_id) {
|
|
|
|
// Generate the Dialog Box for the URLs to the items thumb, resize and fullsize image.
|
2011-08-04 18:46:35 +00:00
|
|
|
$item = ORM::factory("item", $item_id);
|
2009-08-02 19:11:07 +00:00
|
|
|
access::required("view", $item);
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the current page is an album, only display a URL and thumnail fields.
|
2009-08-02 19:11:07 +00:00
|
|
|
if ($item->is_album()) {
|
|
|
|
$linkArray[0] = array("Album URL:", url::abs_site("{$item->type}s/{$item->id}"));
|
|
|
|
$linkArray[1] = array("Thumbnail:", $item->thumb_url(true));
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkTitles[0] = array("URLs:", 2);
|
|
|
|
|
|
|
|
// If the item is a movie, do not display the resize url.
|
|
|
|
} elseif ($item->is_movie()) {
|
|
|
|
// Link to the current page.
|
|
|
|
$linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}"));
|
|
|
|
$linkArray[1] = array("Thumbnail:", $item->thumb_url(true));
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display its URL.
|
|
|
|
if (access::can("view_full", $item)) {
|
|
|
|
$linkArray[2] = array("Video File:", $item->file_url(true));
|
|
|
|
$linkTitles[0] = array("URLs:", 3);
|
|
|
|
} else {
|
|
|
|
$linkTitles[0] = array("URLs:", 2);
|
|
|
|
}
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-25 00:47:42 +00:00
|
|
|
// Or else assume the item is a photo.
|
2009-08-02 19:11:07 +00:00
|
|
|
} else {
|
|
|
|
// Link to the current page.
|
|
|
|
$linkArray[0] = array("This Page:", url::abs_site("{$item->type}s/{$item->id}"));
|
|
|
|
$linkArray[1] = array("Thumbnail:", $item->thumb_url(true));
|
|
|
|
$linkArray[2] = array("Resized:", $item->resize_url(true));
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-02 19:11:07 +00:00
|
|
|
// If the visitor has suficient privlidges to see the fullsized
|
|
|
|
// version of the current image, then display its URL.
|
|
|
|
if (access::can("view_full", $item)) {
|
2009-08-25 00:47:42 +00:00
|
|
|
$linkArray[3] = array("Full Size:", $item->file_url(true));
|
2009-08-02 19:11:07 +00:00
|
|
|
$linkTitles[0] = array("URLs:", 4);
|
|
|
|
} else {
|
|
|
|
$linkTitles[0] = array("URLs:", 3);
|
|
|
|
}
|
|
|
|
}
|
2011-08-04 18:46:35 +00:00
|
|
|
|
2009-08-02 19:11:07 +00:00
|
|
|
$view = new View("embedlinks_fullurldialog.html");
|
|
|
|
$view->titles = $linkTitles;
|
|
|
|
$view->details = $linkArray;
|
|
|
|
print $view;
|
|
|
|
}
|
2009-07-09 01:36:56 +00:00
|
|
|
}
|