aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/avatar/remove.php34
-rw-r--r--actions/avatar/revert.php15
-rw-r--r--actions/comments/delete.php17
-rw-r--r--actions/friends/collections/add.php3
4 files changed, 40 insertions, 29 deletions
diff --git a/actions/avatar/remove.php b/actions/avatar/remove.php
new file mode 100644
index 000000000..cd38e456a
--- /dev/null
+++ b/actions/avatar/remove.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Avatar remove action
+ */
+
+$guid = get_input('guid');
+$user = get_entity($guid);
+if ($user) {
+ // Delete all icons from diskspace
+ $icon_sizes = elgg_get_config('icon_sizes');
+ foreach ($icon_sizes as $name => $size_info) {
+ $file = new ElggFile();
+ $file->owner_guid = $guid;
+ $file->setFilename("profile/{$guid}{$name}.jpg");
+ $filepath = $file->getFilenameOnFilestore();
+ if (!$file->delete()) {
+ elgg_log("Avatar file remove failed. Remove $filepath manually, please.", 'WARNING');
+ }
+ }
+
+ // Remove crop coords
+ unset($user->x1);
+ unset($user->x2);
+ unset($user->y1);
+ unset($user->y2);
+
+ // Remove icon
+ unset($user->icontime);
+ system_message(elgg_echo('avatar:remove:success'));
+} else {
+ register_error(elgg_echo('avatar:remove:fail'));
+}
+
+forward(REFERER);
diff --git a/actions/avatar/revert.php b/actions/avatar/revert.php
deleted file mode 100644
index 8cff40a68..000000000
--- a/actions/avatar/revert.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Avatar revert action
- */
-
-$guid = get_input('guid');
-$user = get_entity($guid);
-if ($user) {
- unset($user->icontime);
- system_message(elgg_echo('avatar:revert:success'));
-} else {
- register_error(elgg_echo('avatar:revert:fail'));
-}
-
-forward(REFERER);
diff --git a/actions/comments/delete.php b/actions/comments/delete.php
index f8458a152..f2c058ff4 100644
--- a/actions/comments/delete.php
+++ b/actions/comments/delete.php
@@ -12,19 +12,12 @@ if (!elgg_is_logged_in()) {
// Make sure we can get the comment in question
$annotation_id = (int) get_input('annotation_id');
-if ($comment = elgg_get_annotation_from_id($annotation_id)) {
-
- $entity = get_entity($comment->entity_guid);
-
- if ($comment->canEdit()) {
- $comment->delete();
- system_message(elgg_echo("generic_comment:deleted"));
- forward($entity->getURL());
- }
-
+$comment = elgg_get_annotation_from_id($annotation_id);
+if ($comment && $comment->canEdit()) {
+ $comment->delete();
+ system_message(elgg_echo("generic_comment:deleted"));
} else {
- $url = "";
+ register_error(elgg_echo("generic_comment:notdeleted"));
}
-register_error(elgg_echo("generic_comment:notdeleted"));
forward(REFERER); \ No newline at end of file
diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php
index 1e2bc1d5c..9dc17b37e 100644
--- a/actions/friends/collections/add.php
+++ b/actions/friends/collections/add.php
@@ -20,8 +20,7 @@ if ($id) {
$result = update_access_collection($id, $friends);
if ($result) {
system_message(elgg_echo("friends:collectionadded"));
- // go to the collections page
- forward("pg/collections/" . get_loggedin_user()->username);
+ forward("collections/" . elgg_get_logged_in_user_entity()->username);
} else {
register_error(elgg_echo("friends:nocollectionname"));
forward(REFERER);