aboutsummaryrefslogtreecommitdiff
path: root/mod/notifications/actions/save.php
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-13 01:11:33 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-05-13 01:11:33 +0000
commit402134632f0d60e9644d0121c2a84db4a4c1a169 (patch)
treef6bf653ec6b8a955ec77ff18fd9199583b79cfc0 /mod/notifications/actions/save.php
parent4ae064871ba9dca9f03e095671db48815632d070 (diff)
downloadelgg-402134632f0d60e9644d0121c2a84db4a4c1a169.tar.gz
elgg-402134632f0d60e9644d0121c2a84db4a4c1a169.tar.bz2
merged in notifications plugin cleanup from 1.7 branch: [5962], [5978] - [5980], [6000]
git-svn-id: http://code.elgg.org/elgg/trunk@6020 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/notifications/actions/save.php')
-rw-r--r--mod/notifications/actions/save.php70
1 files changed, 33 insertions, 37 deletions
diff --git a/mod/notifications/actions/save.php b/mod/notifications/actions/save.php
index a4a5903f9..f8b533d23 100644
--- a/mod/notifications/actions/save.php
+++ b/mod/notifications/actions/save.php
@@ -1,42 +1,38 @@
<?php
- /**
- * Elgg notifications
- *
- * @package ElggNotifications
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.com/
- */
+/**
+ * Elgg notifications
+ *
+ * @package ElggNotifications
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.com/
+ */
- // Restrict to logged in users
- gatekeeper();
-
- global $SESSION;
-
- global $NOTIFICATION_HANDLERS;
- foreach($NOTIFICATION_HANDLERS as $method => $foo) {
- $subscriptions[$method] = get_input($method.'subscriptions');
- $personal[$method] = get_input($method.'personal');
- $collections[$method] = get_input($method.'collections');
-
- $metaname = 'collections_notifications_preferences_' . $method;
- $_SESSION['user']->$metaname = $collections[$method];
- set_user_notification_setting($_SESSION['user']->guid, $method, ($personal[$method] == '1') ? true : false);
- remove_entity_relationships($SESSION['user']->guid,'notify' . $method, false, 'user');
- }
-
- // Add new ones
- foreach($subscriptions as $key => $subscription)
- if (is_array($subscription) && !empty($subscription)) {
- foreach($subscription as $subscriptionperson) {
- add_entity_relationship($_SESSION['user']->guid, 'notify' . $key, $subscriptionperson);
- }
+$user = get_loggedin_user();
+
+global $NOTIFICATION_HANDLERS;
+foreach($NOTIFICATION_HANDLERS as $method => $foo) {
+ $subscriptions[$method] = get_input($method.'subscriptions');
+ $personal[$method] = get_input($method.'personal');
+ $collections[$method] = get_input($method.'collections');
+
+ $metaname = 'collections_notifications_preferences_' . $method;
+ $user->$metaname = $collections[$method];
+ set_user_notification_setting($user->guid, $method, ($personal[$method] == '1') ? true : false);
+ remove_entity_relationships($user->guid, 'notify' . $method, false, 'user');
+}
+
+// Add new ones
+foreach($subscriptions as $key => $subscription) {
+ if (is_array($subscription) && !empty($subscription)) {
+ foreach($subscription as $subscriptionperson) {
+ add_entity_relationship($user->guid, 'notify' . $key, $subscriptionperson);
}
-
- system_message(elgg_echo('notifications:subscriptions:success'));
-
- forward($_SERVER['HTTP_REFERER']);
+ }
+}
+
+system_message(elgg_echo('notifications:subscriptions:success'));
-?> \ No newline at end of file
+forward($_SERVER['HTTP_REFERER']);