aboutsummaryrefslogtreecommitdiff
path: root/actions/avatar
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-07-01 23:20:47 +0200
committerSem <sembrestels@riseup.net>2012-07-01 23:20:47 +0200
commit671f9ba4e1b1972d8eaf22acfb626fa2c85af0f2 (patch)
tree436b0de846650bce13436b51a2d5214224f8898c /actions/avatar
parent3da3f2aa28a42c23bdc9d661e7e13fd6f2bd2b10 (diff)
parentb91d8bb0fea5cef9fafea72181a0007cfaa54725 (diff)
downloadelgg-671f9ba4e1b1972d8eaf22acfb626fa2c85af0f2.tar.gz
elgg-671f9ba4e1b1972d8eaf22acfb626fa2c85af0f2.tar.bz2
Upgraded to Elgg 1.8.6.
Merge tag '1.8.6' of git://github.com/Elgg/Elgg into lorea-preprod Elgg 1.8.6 release
Diffstat (limited to 'actions/avatar')
-rw-r--r--actions/avatar/remove.php34
-rw-r--r--actions/avatar/revert.php15
2 files changed, 34 insertions, 15 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);