aboutsummaryrefslogtreecommitdiff
path: root/mod/file
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file')
-rw-r--r--mod/file/actions/download.php38
-rw-r--r--mod/file/actions/upload.php46
-rw-r--r--mod/file/friends.php34
-rw-r--r--mod/file/index.php30
-rw-r--r--mod/file/languages/en.php45
-rw-r--r--mod/file/start.php131
-rw-r--r--mod/file/upload.php15
-rw-r--r--mod/file/views/default/file/file.php40
-rw-r--r--mod/file/views/default/file/footer.php29
-rw-r--r--mod/file/views/default/file/icon.php23
-rw-r--r--mod/file/views/default/file/upload.php25
-rw-r--r--mod/file/world.php31
12 files changed, 0 insertions, 487 deletions
diff --git a/mod/file/actions/download.php b/mod/file/actions/download.php
deleted file mode 100644
index 19ef86d90..000000000
--- a/mod/file/actions/download.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
- /**
- * Elgg file browser download action.
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- // Get the guid
- $file_guid = get_input("file_guid");
-
- // Get the file
- $file = get_entity($file_guid);
-
- if ($file)
- {
- $mime = $file->getMimeType();
- if (!$mime) $mime = "application/octet-stream";
-
- $filename = $file->getFilename();
-
- header("Content-type: $mime");
- header("Content-Disposition: attachment; filename=\"$filename\"");
-
- $file->open("read");
-
- while (!$file->eof())
- {
- echo $file->read(10240, $file->tell());
- }
-
- $file->close();
- }
- else
- system_message(elgg_echo("file:downloadfailed"));
-?> \ No newline at end of file
diff --git a/mod/file/actions/upload.php b/mod/file/actions/upload.php
deleted file mode 100644
index 410fecc95..000000000
--- a/mod/file/actions/upload.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
- /**
- * Elgg file browser uploader action
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- global $CONFIG;
-
- // Get variables
- $title = get_input("title");
- $desc = get_input("description");
- $tags = get_input("tags");
-
- // Extract file from, save to default filestore (for now)
- $prefix = "/file/";
- $file = new ElggFile();
- $result = $file->save();
-
- if ($result)
- {
- $file->setFilename($prefix.$_FILES['upload']['name']);
- $file->setMimeType($_FILES['upload']['type']);
-
- $file->open("write");
- $file->write(get_uploaded_file('upload'));
- $file->close();
-
- $file->title = $title;
- $file->description = $desc;
-
- $result = $file->save();
-
- // Save tags
- $tags = explode(",", $tags);
- $file->tag = $tags;
- }
-
- if ($result)
- system_message(elgg_echo("file:saved"));
- else
- system_message(elgg_echo("file:uploadfailed"));
-?> \ No newline at end of file
diff --git a/mod/file/friends.php b/mod/file/friends.php
deleted file mode 100644
index a58912485..000000000
--- a/mod/file/friends.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
- /**
- * Elgg file browser
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- $limit = get_input("limit", 10);
- $offset = get_input("offset", 0);
-
- // Get objects of friends
- $owners = array();
- $users = get_entities_from_relationship("friend", page_owner(), false, "", "", 0, "time_created desc", $limit, $offset);
- if ($users)
- {
- foreach ($users as $user)
- $owners[] = $user->getOwner();
- $objects = get_entities("object","file", $owners, "time_created desc", $limit, $offset);
- }
-
- // Draw page
- $body .= file_draw($objects);
-
- // Draw footer
- $body .= file_draw_footer($limit, $offset);
-
- // Finally draw the page
- page_draw(sprintf(elgg_echo("file:friends"),$_SESSION['user']->name), $body);
-?> \ No newline at end of file
diff --git a/mod/file/index.php b/mod/file/index.php
deleted file mode 100644
index 896eb9e94..000000000
--- a/mod/file/index.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
- /**
- * Elgg file browser
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- *
- *
- * TODO: File icons, download & mime types
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- $limit = get_input("limit", 10);
- $offset = get_input("offset", 0);
-
- // Get objects
- $objects = get_entities("object","file", page_owner(), "time_created desc", $limit, $offset);
-
- // Draw page
- $body .= file_draw($objects);
-
- // Draw footer
- $body .= file_draw_footer($limit, $offset);
-
- // Finally draw the page
- page_draw(sprintf(elgg_echo("file:yours"),$_SESSION['user']->name), $body);
-?> \ No newline at end of file
diff --git a/mod/file/languages/en.php b/mod/file/languages/en.php
deleted file mode 100644
index eeae1de02..000000000
--- a/mod/file/languages/en.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
- /**
- * Elgg file plugin language pack
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $english = array(
-
- /**
- * Menu items and titles
- */
-
- 'file' => "Files",
- 'file:yours' => "%s's files",
- 'file:friends' => "%s's friend's files",
- 'file:all' => "All files",
-
- 'file:upload' => "Upload a file",
-
- 'file:file' => "File",
- 'file:title' => "Title",
- 'file:desc' => "Description",
- 'file:tags' => "Tags",
-
- /**
- * Status messages
- */
-
- 'file:saved' => "Your file was successfully saved.",
-
- /**
- * Error messages
- */
-
- 'file:uploadfailed' => "Sorry; we could not save your file.",
- 'file:downloadfailed' => "Sorry; this file is not available at this time.",
-
- );
-
- add_translation("en",$english);
-?> \ No newline at end of file
diff --git a/mod/file/start.php b/mod/file/start.php
deleted file mode 100644
index 2783e6e64..000000000
--- a/mod/file/start.php
+++ /dev/null
@@ -1,131 +0,0 @@
-<?php
- /**
- * Elgg file browser
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
-
- /**
- * File plugin initialisation functions.
- */
- function file_init()
- {
- // Get config
- global $CONFIG;
-
- // Set up menu for logged in users
- if (isloggedin())
- {
- add_menu(elgg_echo('file'), $CONFIG->wwwroot . "pg/file/" . $_SESSION['user']->username, array(
- menu_item(sprintf(elgg_echo("file:yours"),$_SESSION['user']->name), $CONFIG->wwwroot . "pg/file/" . $_SESSION['user']->username),
- menu_item(sprintf(elgg_echo('file:friends'),$_SESSION['user']->name), $CONFIG->wwwroot . "pg/file/". $_SESSION['user']->username . "/friends/"),
- menu_item(elgg_echo('file:all'), $CONFIG->wwwroot . "pg/file/". $_SESSION['user']->username . "/world/"),
- menu_item(elgg_echo('file:upload'), $CONFIG->wwwroot . "pg/file/". $_SESSION['user']->username . "/new/")
- ));
- }
- else
- {
- add_menu(elgg_echo('file'), $CONFIG->wwwroot . "pg/file/" . $_SESSION['user']->username . "/", array(
- menu_item(elgg_echo('file:all'), $CONFIG->wwwroot . "pg/file/". $_SESSION['user']->username . "/world/"),
- ));
- }
-
- // Register a page handler, so we can have nice URLs
- register_page_handler('file','file_page_handler');
-
- }
-
- /**
- * File page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
- function file_page_handler($page) {
-
- global $CONFIG;
-
- // The username should be the file we're getting
- if (isset($page[0])) {
- set_input('username',$page[0]);
- }
-
- if (isset($page[1]))
- {
- switch($page[1])
- {
- case "friends":
- include($CONFIG->pluginspath . "file/friends.php");
- break;
- case "world":
- include($CONFIG->pluginspath . "file/world.php");
- break;
- case "new":
- include($CONFIG->pluginspath . "file/upload.php");
- break;
- }
- }
- else
- {
- // Include the standard profile index
- include($CONFIG->pluginspath . "file/index.php");
- }
-
- }
-
- /**
- * Draw an individual file.
- *
- * @param ElggFile $file
- */
- function file_draw_file(ElggFile $file)
- {
- // Get tags
- $tags = $file->getMetaData("tag");
- if (!is_array($tags))
- $tags = array($tags);
-
- // Draw file
- return elgg_view("file/file", array(
- "file_guid" => $file->guid,
- "tags" => $tags,
- "title" => $file->title,
- "description" => $file->description,
- "mimetype" => $file->getMimeType()
- ));
- }
-
- /**
- * Draw a given set of objects.
- *
- * @param array $objects
- */
- function file_draw(array $objects)
- {
- $body = "";
-
- foreach ($objects as $object)
- $body .= file_draw_file($object);
-
- return $body;
- }
-
- function file_draw_footer($limit, $offset)
- {
- return elgg_view("file/footer", array(
- "limit" => $limit,
- "offset" => $offset
- ));
- }
-
- // Make sure test_init is called on initialisation
- register_event_handler('init','system','file_init');
-
- // Register actions
- register_action("file/upload", false, $CONFIG->pluginspath . "file/actions/upload.php");
- register_action("file/download", false, $CONFIG->pluginspath. "file/actions/download.php");
-
-?> \ No newline at end of file
diff --git a/mod/file/upload.php b/mod/file/upload.php
deleted file mode 100644
index 51da6be3a..000000000
--- a/mod/file/upload.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
- /**
- * Elgg file browser uploader
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- gatekeeper();
-
- // Render the file upload page
- page_draw(elgg_echo("file:upload"), elgg_view("file/upload", NULL));
-?> \ No newline at end of file
diff --git a/mod/file/views/default/file/file.php b/mod/file/views/default/file/file.php
deleted file mode 100644
index d2efa1b0c..000000000
--- a/mod/file/views/default/file/file.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
- /**
- * Elgg file browser.
- * File renderer.
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- global $CONFIG;
-
- $file_guid = $vars['file_guid'];
- $tags = $vars['tags'];
- $title = $vars['title'];
- $desc = $vars['description'];
-
- $mime = $vars['mimetype'];
-
-?>
-<div class="file">
- <table width="100%">
- <tr>
- <td valign="top" width="100">
- <div class="file_icon">
- <a href="<?php echo $vars['url']; ?>action/file/download?file_guid=<?php echo $file_guid; ?>"><?php echo elgg_view("file/icon", array("mimetype" => $mime)); ?></a>
- </div>
- </td>
- <td valign="top">
- <div class="title"><?php echo $title; ?></div>
- <div class="description"><?php echo $desc; ?></div>
- <div class="tags"><?php
- foreach ($tags as $tag)
- echo "<a href=\"" . $CONFIG->wwwroot . "pg/file/". $_SESSION['user']->username . "/world/?tag=$tag\">$tag</a> ";
- ?></div>
- </td>
- </tr>
- </table>
-</div>
diff --git a/mod/file/views/default/file/footer.php b/mod/file/views/default/file/footer.php
deleted file mode 100644
index 149c87e5a..000000000
--- a/mod/file/views/default/file/footer.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
- /**
- * Elgg file browser footer
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- $limit = $vars['limit'];
- $offset = $vars['offset'];
- $url = $_SERVER['request_uri'];
-?>
-<div id="navbar">
- <table width="100%">
- <tr>
- <td>
- <div id="prev"><?php if ($offset>0) { ?><a href="<?php echo "$url?offset=" . ($offset-$limit); ?>">Prev</a><?php } ?>
- </div>
- </td>
- <td align="right">
- <div id="next">
- <a href="<?php echo "$url?offset=" . ($offset+$limit); ?>">Next</a>
- </div>
- </td>
- </tr>
- </table>
-</div> \ No newline at end of file
diff --git a/mod/file/views/default/file/icon.php b/mod/file/views/default/file/icon.php
deleted file mode 100644
index 266a60a47..000000000
--- a/mod/file/views/default/file/icon.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
- /**
- * Elgg file icons.
- * Displays an icon, depending on its mime type, for a file.
- * Optionally you can specify a size.
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
-
- $mime = $vars['mimetype'];
-
- $width = $vars['width'];
- $height = $vars['height'];
-
- if (!$width) $width = 100;
- if (!$height) $height = 100;
-
- echo $mime;
-?> \ No newline at end of file
diff --git a/mod/file/views/default/file/upload.php b/mod/file/views/default/file/upload.php
deleted file mode 100644
index d318b85a3..000000000
--- a/mod/file/views/default/file/upload.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
- /**
- * Elgg file browser uploader
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- global $CONFIG;
-
-?>
-<form action="<?php echo $vars['url']; ?>action/file/upload" enctype="multipart/form-data" method="post">
-
- <table>
- <tr><td><?php echo elgg_echo("file:file");?>:</td><td><div id="file"><input type="file" name="upload" /></div></td></tr>
- <tr><td><?php echo elgg_echo("file:title");?>:</td><td><div id="title"><input type="text" name="title" size="49" /></div></td></tr>
- <tr><td valign="top"><?php echo elgg_echo("file:desc");?>:</td><td><div id="description"><textarea name="description" cols="50" rows="10"></textarea></div></td></tr>
- <tr><td valign="top"><?php echo elgg_echo("file:tags");?>:</td><td><div id="tags"><textarea name="tags" cols="50"></textarea></div></td></tr>
- </table>
-
- <input type="submit" name="Upload" value="Upload" />
-
-</form> \ No newline at end of file
diff --git a/mod/file/world.php b/mod/file/world.php
deleted file mode 100644
index ffb689050..000000000
--- a/mod/file/world.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
- /**
- * Elgg file browser
- *
- * @package ElggFile
- * @author Marcus Povey
- * @copyright Curverider Ltd 2008
- * @link http://elgg.com/
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- $limit = get_input("limit", 10);
- $offset = get_input("offset", 0);
- $tag = get_input("tag");
-
- // Get objects
- if ($tag!="")
- $objects = get_entities_from_metadata("tag", $tag, "object", "file", $limit, $offset);
- else
- $objects = get_entities("object","file", "", "time_created desc", $limit, $offset);
-
- // Draw page
- $body .= file_draw($objects);
-
- // Draw footer
- $body .= file_draw_footer($limit, $offset);
-
- // Finally draw the page
- page_draw(sprintf(elgg_echo("file:yours"),$_SESSION['user']->name), $body);
-?> \ No newline at end of file