diff options
-rw-r--r-- | pages/download.php | 52 | ||||
-rw-r--r-- | views/rss/object/image.php | 19 | ||||
-rw-r--r-- | views/rss/tidypics/gallery.php | 18 |
3 files changed, 89 insertions, 0 deletions
diff --git a/pages/download.php b/pages/download.php new file mode 100644 index 000000000..f5530cebc --- /dev/null +++ b/pages/download.php @@ -0,0 +1,52 @@ +<?php
+ /**
+ * Tidypics Download Photos
+ *
+ * do not call this directly - call through page handler
+ */
+
+ global $CONFIG;
+
+ $file_guid = (int) get_input("file_guid");
+ $file = get_entity($file_guid);
+
+ $type = get_input("type");
+
+ if ($file) {
+ $filename = $file->originalfilename;
+ $mime = $file->mimetype;
+
+ header("Content-Type: $mime");
+ if ($type == "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/views/rss/object/image.php b/views/rss/object/image.php new file mode 100644 index 000000000..dafc05f45 --- /dev/null +++ b/views/rss/object/image.php @@ -0,0 +1,19 @@ +<?php
+
+$title = $vars['entity']->title;
+$descr = $vars['entity']->description;
+$download = $vars['url'] . 'pg/photos/download/' . $vars['entity']->guid . '/inline/';
+$base_url = $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=';
+?>
+
+ <item>
+ <title><?php echo $title; ?></title>
+ <link><?php echo $base_url . $vars['entity']->guid . '&size=large'; ?></link>
+ <description><?php echo htmlentities($descr, ENT_QUOTES); ?></description>
+ <pubDate><?php echo date("r", $vars['entity']->time_created); ?></pubDate>
+ <guid isPermaLink="true"><?php echo $vars['entity']->getURL(); ?></guid>
+ <media:content url="<?php echo $download; ?>" medium="image" type="<?php echo $vars['entity']->getMimeType(); ?>" />
+ <media:title><?php echo $title; ?></media:title>
+ <media:description><?php echo htmlentities($descr); ?></media:description>
+ <media:thumbnail url="<?php echo $base_url . $vars['entity']->guid . '&size=thumb'; ?>"></media:thumbnail>
+ </item>
\ No newline at end of file diff --git a/views/rss/tidypics/gallery.php b/views/rss/tidypics/gallery.php new file mode 100644 index 000000000..2fcf2ac76 --- /dev/null +++ b/views/rss/tidypics/gallery.php @@ -0,0 +1,18 @@ +<?php
+ /**
+ * Tidypics Listing RSS View
+ */
+
+$context = $vars['context'];
+$entities = $vars['entities'];
+$count = $vars['count'];
+$baseurl = $vars['baseurl'];
+
+
+if (is_array($entities) && sizeof($entities) > 0) {
+ foreach($entities as $entity) {
+ echo elgg_view_entity($entity);
+ }
+}
+
+?>
\ No newline at end of file |