aboutsummaryrefslogtreecommitdiff
path: root/mod/bookmarks/actions/edit.php
blob: dd0330b2d5d82a3ac26fd539f98831bff3131388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
 * Elgg bookmarks edit action
 * 
 */
	
gatekeeper();
action_gatekeeper();
//set some required variables
$guid = get_input('guid');
$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);

// Make sure we actually have permission to edit
$bookmark = get_entity($guid);
if ($bookmark->getSubtype() == "bookmarks" && $bookmark->canEdit()) {
	$bookmark->title = $title;
	$bookmark->description = $notes;
	$bookmark->address = $address;
	$bookmark->access_id = $access;
	$bookmark->tags = $tagarray;
	if ($bookmark->save()) {
		system_message(elgg_echo('bookmarks:edit:success'));
	} else {
		system_message(elgg_echo('bookmarks:edit:fail'));
	}
}else{
	system_message(elgg_echo('bookmarks:edit:fail'));
}
$account = get_entity($bookmark->container_guid);
forward("pg/bookmarks/" . $account->username);