diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 23:15:07 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-03 23:15:07 +0000 |
commit | 0320936f29dd83534b5af386a981131be7981a9a (patch) | |
tree | 1d524f4a43c5974bf10b1177a8935754ee176ec5 /mod/bookmarks/actions/add.php | |
parent | e2ba75ce7dad46f87c43b7ef256e79053af5566e (diff) | |
download | elgg-0320936f29dd83534b5af386a981131be7981a9a.tar.gz elgg-0320936f29dd83534b5af386a981131be7981a9a.tar.bz2 |
Updated bookmarks with new interface.
git-svn-id: http://code.elgg.org/elgg/trunk@5266 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/bookmarks/actions/add.php')
-rw-r--r-- | mod/bookmarks/actions/add.php | 107 |
1 files changed, 38 insertions, 69 deletions
diff --git a/mod/bookmarks/actions/add.php b/mod/bookmarks/actions/add.php index a074719b1..be2f79f82 100644 --- a/mod/bookmarks/actions/add.php +++ b/mod/bookmarks/actions/add.php @@ -1,72 +1,41 @@ <?php - - /** - * Elgg bookmarks add/save action - * - * @package ElggBookmarks - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ +/** + * Elgg bookmarks add/save action + * + * @package ElggBookmarks + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider <info@elgg.com> + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ - gatekeeper(); - - $title = get_input('title'); - $guid = get_input('bookmark_guid',0); - $description = get_input('description'); - $address = get_input('address'); - $access = get_input('access'); - $shares = get_input('shares',array()); +gatekeeper(); +action_gatekeeper(); +//set some required variables +$title = get_input('title'); +$address = get_input('address'); +$notes = get_input('notes'); +$access = get_input('access'); +$tags = get_input('tags'); +$tagarray = string_to_tag_array($tags); +//create a new bookmark object +$entity = new ElggObject; +$entity->subtype = "bookmarks"; +$entity->owner_guid = get_loggedin_user()->getGUID(); +$entity->container_guid = (int)get_input('container_guid', get_loggedin_user()->getGUID()); +$entity->title = $title; +$entity->description = $notes; +$entity->address = $address; +$entity->access_id = $access; +$entity->link_version = create_wire_url_code();//returns a random code in the form {{L:1hp56}} +$entity->tags = $tagarray; - $tags = get_input('tags'); - $tagarray = string_to_tag_array($tags); - - if ($guid == 0) { - - $entity = new ElggObject; - $entity->subtype = "bookmarks"; - $entity->owner_guid = $_SESSION['user']->getGUID(); - $entity->container_guid = (int)get_input('container_guid', $_SESSION['user']->getGUID()); - - } else { - - $canedit = false; - if ($entity = get_entity($guid)) { - if ($entity->canEdit()) { - $canedit = true; - } - } - if (!$canedit) { - system_message(elgg_echo('notfound')); - forward("pg/bookmarks"); - } - - } - - $entity->title = $title; - $entity->address = $address; - $entity->description = $description; - $entity->access_id = $access; - $entity->tags = $tagarray; - - if ($entity->save()) { - $entity->clearRelationships(); - $entity->shares = $shares; - - if (is_array($shares) && sizeof($shares) > 0) { - foreach($shares as $share) { - $share = (int) $share; - add_entity_relationship($entity->getGUID(),'share',$share); - } - } - system_message(elgg_echo('bookmarks:save:success')); - //add to river - add_to_river('river/object/bookmarks/create','create',$_SESSION['user']->guid,$entity->guid); - forward($entity->getURL()); - } else { - register_error(elgg_echo('bookmarks:save:failed')); - forward("pg/bookmarks"); - } - -?> +if ($entity->save()) { + system_message(elgg_echo('bookmarks:save:success')); + //add to river + add_to_river('river/object/bookmarks/create','create',$_SESSION['user']->guid,$entity->guid); +} else { + register_error(elgg_echo('bookmarks:save:failed')); +} +$account = get_entity((int)get_input('container_guid', get_loggedin_user()->getGUID())); +forward("pg/bookmarks/" . $account->username);
\ No newline at end of file |