aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/download.php52
-rw-r--r--start.php26
-rw-r--r--views/default/object/image.php2
-rw-r--r--views/default/tidypics/image_menu.php2
-rw-r--r--views/rss/object/album.php4
-rw-r--r--views/rss/object/file.php2
6 files changed, 12 insertions, 76 deletions
diff --git a/actions/download.php b/actions/download.php
deleted file mode 100644
index b382c56bc..000000000
--- a/actions/download.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
- /**
- * Tidypics Download File Action
- *
- * do not call this directly - call through action handler
- */
-
- global $CONFIG;
-
- $file_guid = (int) get_input("file_guid");
- $file = get_entity($file_guid);
-
- $view = get_input("view");
-
- if ($file) {
- $filename = $file->originalfilename;
- $mime = $file->mimetype;
-
- header("Content-Type: $mime");
- if ($view == "inline")
- header("Content-Disposition: inline; filename=\"$filename\"");
- else
- header("Content-Disposition: attachment; filename=\"$filename\"");
-
-
- $readfile = new ElggFile($file_guid);
- $readfile->owner_guid = $file->owner_guid;
-
- $contents = $readfile->grabFile();
-
- if (empty($contents)) {
- echo file_get_contents(dirname(dirname(__FILE__)) . "/graphics/image_error_large.png" );
- } else {
-
- // expires every 60 days
- $expires = 60 * 60*60*24;
-
- header("Content-Length: " . strlen($contents));
- header("Cache-Control: public", true);
- header("Pragma: public", true);
- header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT', true);
-
-
- echo $contents;
- }
-
- exit;
- }
- else
- register_error(elgg_echo("image:downloadfailed"));
-
-?> \ No newline at end of file
diff --git a/start.php b/start.php
index 54322d8c9..6a1b95723 100644
--- a/start.php
+++ b/start.php
@@ -72,10 +72,7 @@
}
// slideshow plugin hook
- register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
-
- // no checking security token for download
- register_plugin_hook('action', 'tidypics/download', 'tidypics_download_override');
+ register_plugin_hook('tp_slideshow', 'album', 'tidypics_slideshow');
}
/**
@@ -273,6 +270,12 @@
include($CONFIG->pluginspath . "tidypics/pages/world.php");
break;
+ case "download": // download an image
+ if (isset($page[1])) set_input('file_guid', $page[1]);
+ if (isset($page[2])) set_input('type', $page[2]);
+ include($CONFIG->pluginspath . "tidypics/pages/download.php");
+ break;
+
case "tagged": // all photos tagged with user
if (isset($page[1])) set_input('guid',$page[1]);
include($CONFIG->pluginspath . "tidypics/pages/tagged.php");
@@ -425,20 +428,6 @@
function tp_mostrecentimages($max = 8, $pagination = true) {
return list_entities("object", "image", 0, $max, false, false, $pagination);
}
- /**
- * Called before validating the security token on a download link
- * We don't need security as this is not a true action (it doesn't change any data)
- *
- * @return false (shouldn't return though since the action exits
- */
- function tidypics_download_override($hook, $action)
- {
- global $CONFIG;
-
- include $CONFIG->actions[$action]['file'];
-
- return false;
- }
// Make sure tidypics_init is called on initialisation
@@ -453,7 +442,6 @@
register_action("tidypics/edit", false, $CONFIG->pluginspath. "tidypics/actions/edit.php");
register_action("tidypics/delete", false, $CONFIG->pluginspath. "tidypics/actions/delete.php");
register_action("tidypics/edit_multi", false, $CONFIG->pluginspath. "tidypics/actions/edit_multi.php");
- register_action("tidypics/download", true, $CONFIG->pluginspath . "tidypics/actions/download.php");
register_action("tidypics/addtag", true, $CONFIG->pluginspath . "tidypics/actions/addtag.php");
register_action("tidypics/deletetag", true, $CONFIG->pluginspath . "tidypics/actions/deletetag.php");
register_action("tidypics/flickrSetup", true, $CONFIG->pluginspath . "tidypics/actions/flickrSetup.php");
diff --git a/views/default/object/image.php b/views/default/object/image.php
index dd52f872e..fb7a72ff8 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -150,7 +150,7 @@
$image_link = false;
if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
// admin allows downloads so default to inline download link
- $image_link = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid . "&amp;view=inline";
+ $image_link = $vars['url'] . "pg/photos/download/{$image_guid}/inline/";
}
// does any plugin want to override the link
$image_link = trigger_plugin_hook('tp_image_link', 'image', $image, $image_link);
diff --git a/views/default/tidypics/image_menu.php b/views/default/tidypics/image_menu.php
index 5e6053a94..9e7a53969 100644
--- a/views/default/tidypics/image_menu.php
+++ b/views/default/tidypics/image_menu.php
@@ -43,7 +43,7 @@
}
if (get_plugin_setting('download_link', 'tidypics') != "disabled") {
- $download_url = $vars['url'] . "action/tidypics/download?file_guid=" . $image_guid;
+ $download_url = $vars['url'] . "pg/photos/download/{$image_guid}/";
?>
<li id="download_image"><a href="<?php echo $download_url; ?>"><?php echo elgg_echo("image:download"); ?></a></li>
<?php
diff --git a/views/rss/object/album.php b/views/rss/object/album.php
index c66c0f7e9..c59f0e2d3 100644
--- a/views/rss/object/album.php
+++ b/views/rss/object/album.php
@@ -12,7 +12,7 @@
$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
// use fullsize image
- $base_url_fullsize = $vars['url'] . 'action/tidypics/download?file_guid=';
+ $base_url_fullsize = $vars['url'] . 'pg/photos/download/';
// insert cover image if it exists image
if ($album->cover) {
@@ -52,7 +52,7 @@
<description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
<pubDate><?php echo date("r", $image->time_created); ?></pubDate>
<guid isPermaLink="true"><?php echo $image->getURL(); ?></guid>
- <media:content url="<?php echo $base_url_fullsize . $image->guid . '&amp;view=inline'; ?>" medium="image" type="<?php echo $image->getMimeType(); ?>" />
+ <media:content url="<?php echo $base_url_fullsize . $image->guid . '/inline/'; ?>" medium="image" type="<?php echo $image->getMimeType(); ?>" />
<media:title><?php echo $image->title; ?></media:title>
<media:description><?php echo htmlentities($image->description); ?></media:description>
<media:thumbnail url="<?php echo $base_url . $image->guid . '&amp;size=thumb'; ?>"></media:thumbnail>
diff --git a/views/rss/object/file.php b/views/rss/object/file.php
index ace3e28e6..e40da4f69 100644
--- a/views/rss/object/file.php
+++ b/views/rss/object/file.php
@@ -19,5 +19,5 @@
<link><?php echo $vars['entity']->getURL(); ?></link>
<title><![CDATA[<?php echo $title; ?>]]></title>
<description><![CDATA[<?php echo (autop($vars['entity']->description)); ?>]]></description>
- <enclosure url="<?php echo $vars['url']; ?>action/file/download?file_guid=<?php echo $vars['entity']->getGUID(); ?>" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
+ <enclosure url="<?php echo $vars['url']; ?>pg/photos/download/<?php echo $vars['entity']->getGUID(); ?>/" length="<?php echo $vars['entity']->size(); ?>" type="<?php echo $vars['entity']->getMimeType(); ?>" />
</item>