aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/actions
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-15 13:35:37 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-15 13:35:37 +0000
commit1a08a1f4a273737afb508c781d5f39cef021a273 (patch)
tree7b4c1766c7b6d0f1e492e467dccb19869f39445a /mod/blog/actions
parentef3e87ebcf82fbf172aa719e23ef1a6cfca7a948 (diff)
downloadelgg-1a08a1f4a273737afb508c781d5f39cef021a273.tar.gz
elgg-1a08a1f4a273737afb508c781d5f39cef021a273.tar.bz2
Moving some stuff into the plugins repo, where it belongs.
git-svn-id: https://code.elgg.org/elgg/trunk@646 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/actions')
-rw-r--r--mod/blog/actions/add.php66
-rw-r--r--mod/blog/actions/comments/add.php44
-rw-r--r--mod/blog/actions/comments/delete.php34
-rw-r--r--mod/blog/actions/delete.php38
-rw-r--r--mod/blog/actions/edit.php70
5 files changed, 0 insertions, 252 deletions
diff --git a/mod/blog/actions/add.php b/mod/blog/actions/add.php
deleted file mode 100644
index f51bbedac..000000000
--- a/mod/blog/actions/add.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
- /**
- * Elgg blog: add post action
- *
- * @package ElggBlog
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in (send us to the front page if not)
- if (!isloggedin()) forward();
-
- // Get input data
- $title = get_input('blogtitle');
- $body = get_input('blogbody');
- $tags = get_input('blogtags');
-
- // Cache to the session
- $_SESSION['blogtitle'] = $title;
- $_SESSION['blogbody'] = $body;
- $_SESSION['blogtags'] = $tags;
-
- // Convert string of tags into a preformatted array
- $tagarray = string_to_tag_array($tags);
-
- // Make sure the title / description aren't blank
- if (empty($title) || empty($body)) {
- register_error(elgg_echo("blog:blank"));
- forward("mod/blog/add.php");
-
- // Otherwise, save the blog post
- } else {
-
- // Initialise a new ElggObject
- $blog = new ElggObject();
- // Tell the system it's a blog post
- $blog->subtype = "blog";
- // Set its owner to the current user
- $blog->owner_guid = $_SESSION['user']->getGUID();
- // For now, set its access to public (we'll add an access dropdown shortly)
- $blog->access_id = 2;
- // Set its title and description appropriately
- $blog->title = $title;
- $blog->description = $body;
- // Before we can set metadata, we need to save the blog post
- if (!$blog->save()) {
- register_error(elgg_echo("blog:error"));
- forward("mod/blog/add.php");
- }
- // Now let's add tags. We can pass an array directly to the object property! Easy.
- if (is_array($tagarray)) {
- $blog->tags = $tagarray;
- }
- // Success message
- system_message(elgg_echo("blog:posted"));
- // Remove the blog post cache
- unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']);
- // Forward to the main blog page
- forward("mod/blog/?username=" . $_SESSION['user']->username);
-
- }
-
-?> \ No newline at end of file
diff --git a/mod/blog/actions/comments/add.php b/mod/blog/actions/comments/add.php
deleted file mode 100644
index 8a54cde13..000000000
--- a/mod/blog/actions/comments/add.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
- /**
- * Elgg blog: add comment action
- *
- * @package ElggBlog
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in; forward to the front page if not
- if (!isloggedin()) forward();
-
- // Get input
- $blogpost_guid = (int) get_input('blogpost_guid');
- $comment = get_input('comment');
-
- // Let's see if we can get an entity with the specified GUID, and that it's a blog post
- if ($blogpost = get_entity($blogpost_guid)) {
- if ($blogpost->getSubtype() == "blog") {
-
- // If posting the comment was successful, say so
- if ($blogpost->annotate('comment',$comment,$blogpost->access_id, $_SESSION['guid'])) {
-
- system_message(elgg_echo("comment:success"));
-
- } else {
- system_message(elgg_echo("comment:failure"));
- }
-
- }
-
- } else {
-
- system_message(elgg_echo("blog:notfound"));
-
- }
-
- // Forward to the
- forward("mod/blog/read.php?blogpost=" . $blogpost_guid);
-
-?> \ No newline at end of file
diff --git a/mod/blog/actions/comments/delete.php b/mod/blog/actions/comments/delete.php
deleted file mode 100644
index 8eee2c961..000000000
--- a/mod/blog/actions/comments/delete.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
- /**
- * Elgg blog: delete comment action
- *
- * @package ElggBlog
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.org/
- */
-
- // Ensure we're logged in
- if (!isloggedin()) forward();
-
- // Make sure we can get the comment in question
- $comment_id = (int) get_input('comment_id');
- if ($comment = get_annotation($comment_id)) {
-
- $url = "mod/blog/read.php?blogpost=" . $comment->entity_guid;
- if ($comment->canEdit()) {
- $comment->delete();
- system_message(elgg_echo("comment:deleted"));
- forward($url);
- }
-
- } else {
- $url = "";
- }
-
- system_message(elgg_echo("comment:notdeleted"));
- forward($url);
-
-?> \ No newline at end of file
diff --git a/mod/blog/actions/delete.php b/mod/blog/actions/delete.php
deleted file mode 100644
index cb494e59f..000000000
--- a/mod/blog/actions/delete.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
- /**
- * Elgg blog: delete post action
- *
- * @package ElggBlog
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in (send us to the front page if not)
- if (!isloggedin()) forward();
-
- // Get input data
- $guid = (int) get_input('blogpost');
-
- // Make sure we actually have permission to edit
- $blog = get_entity($guid);
- if ($blog->getSubtype() == "blog" && $blog->canEdit()) {
-
- // Get owning user
- $owner = get_entity($blog->getOwner());
- // Delete it!
- $rowsaffected = $blog->delete();
- if ($rowsaffected > 0) {
- // Success message
- system_message(elgg_echo("blog:deleted"));
- } else {
- system_message(elgg_echo("blog:notdeleted"));
- }
- // Forward to the main blog page
- forward("mod/blog/?username=" . $owner->username);
-
- }
-
-?> \ No newline at end of file
diff --git a/mod/blog/actions/edit.php b/mod/blog/actions/edit.php
deleted file mode 100644
index fba4763a6..000000000
--- a/mod/blog/actions/edit.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-
- /**
- * Elgg blog: edit post action
- *
- * @package ElggBlog
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Ben Werdmuller <ben@curverider.co.uk>
- * @copyright Curverider Ltd 2008
- * @link http://elgg.org/
- */
-
- // Make sure we're logged in (send us to the front page if not)
- if (!isloggedin()) forward();
-
- // Get input data
- $guid = (int) get_input('blogpost');
- $title = get_input('blogtitle');
- $body = get_input('blogbody');
- $tags = get_input('blogtags');
-
- // Make sure we actually have permission to edit
- $blog = get_entity($guid);
- if ($blog->getSubtype() == "blog" && $blog->canEdit()) {
-
- // Cache to the session
- $_SESSION['blogtitle'] = $title;
- $_SESSION['blogbody'] = $body;
- $_SESSION['blogtags'] = $tags;
-
- // Convert string of tags into a preformatted array
- $tagarray = string_to_tag_array($tags);
-
- // Make sure the title / description aren't blank
- if (empty($title) || empty($body)) {
- register_error(elgg_echo("blog:blank"));
- forward("mod/blog/add.php");
-
- // Otherwise, save the blog post
- } else {
-
- // Get owning user
- $owner = get_entity($blog->getOwner());
- // For now, set its access to public (we'll add an access dropdown shortly)
- $blog->access_id = 2;
- // Set its title and description appropriately
- $blog->title = $title;
- $blog->description = $body;
- // Before we can set metadata, we need to save the blog post
- if (!$blog->save()) {
- register_error(elgg_echo("blog:error"));
- forward("mod/blog/add.php");
- }
- // Now let's add tags. We can pass an array directly to the object property! Easy.
- $blog->clearMetadata('tags');
- if (is_array($tagarray)) {
- $blog->tags = $tagarray;
- }
- // Success message
- system_message(elgg_echo("blog:posted"));
- // Remove the blog post cache
- unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']);
- // Forward to the main blog page
- forward("mod/blog/?username=" . $owner->username);
-
- }
-
- }
-
-?> \ No newline at end of file