diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-12-23 19:48:36 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-12-23 19:48:36 -0500 |
commit | 926e11996080ee84c6c405910c06615b8db55ff5 (patch) | |
tree | b13e26bce8766cec5b9398bf77449e419851a391 /mod/externalpages/actions | |
parent | 9e311e7236188e826277aed3dca733e02eb21f6a (diff) | |
download | elgg-926e11996080ee84c6c405910c06615b8db55ff5.tar.gz elgg-926e11996080ee84c6c405910c06615b8db55ff5.tar.bz2 |
Fixes #4069 reusing the previous ElggObject for external pages
Diffstat (limited to 'mod/externalpages/actions')
-rw-r--r-- | mod/externalpages/actions/edit.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php index edfffe168..184aa3d82 100644 --- a/mod/externalpages/actions/edit.php +++ b/mod/externalpages/actions/edit.php @@ -1,18 +1,28 @@ <?php /** - * Elgg external pages: add/edit + * Elgg external pages: create or update * */ -// Get input data +// Get input data and don't filter the content $contents = get_input('expagescontent', '', false); $type = get_input('content_type'); -$previous_guid = get_input('expage_guid'); +$guid = get_input('guid'); -// create object to hold the page details -$expages = new ElggObject(); -$expages->subtype = $type; -$expages->owner_guid = get_loggedin_userid(); +if ($guid) { + // update + $expages = get_entity($guid); + if (!$expages) { + register_error(elgg_echo("expages:error")); + forward(REFERER); + } +} else { + // create + $expages = new ElggObject(); + $expages->subtype = $type; +} + +$expages->owner_guid = elgg_get_logged_in_user_guid(); $expages->access_id = ACCESS_PUBLIC; $expages->title = $type; $expages->description = $contents; |