diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:58:59 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:58:59 -0300 |
commit | 31354451ce2c236c9c963064652c39fe54be4afd (patch) | |
tree | 6203d2ba3f7e29518291e2e3999d9fa89892b417 /actions/favorites/add.php | |
download | elgg-31354451ce2c236c9c963064652c39fe54be4afd.tar.gz elgg-31354451ce2c236c9c963064652c39fe54be4afd.tar.bz2 |
Squashed 'mod/elgg-favorites/' content from commit d96e69b
git-subtree-dir: mod/elgg-favorites
git-subtree-split: d96e69bd1365c3e3c4d998e72d9941ea1ea2278b
Diffstat (limited to 'actions/favorites/add.php')
-rw-r--r-- | actions/favorites/add.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/actions/favorites/add.php b/actions/favorites/add.php new file mode 100644 index 000000000..bee00c291 --- /dev/null +++ b/actions/favorites/add.php @@ -0,0 +1,17 @@ +<?php + $entity_guid = (int) get_input('guid'); + $user_guid = elgg_get_logged_in_user_guid(); + if (($entity_guid > 0) && + ($user_guid > 0) && + !check_entity_relationship($user_guid ,'flags_content', $entity_guid)) { + if (add_entity_relationship($user_guid ,'flags_content', $entity_guid)) { + // elgg_dump("Notice: Added flag relationship between $user_guid and $entity_guid. ", FALSE, 'NOTICE'); + system_message(elgg_echo('favorites:added')); + } else { + // elgg_dump("Could not add flag / fav relation between $user_guid and $entity_guid.", FALSE, 'WARN'); + register_error(elgg_echo('favorites:addfailed')); + } + } + if (!elgg_is_xhr()) { + forward($_SERVER['HTTP_REFERER']); + } |