aboutsummaryrefslogtreecommitdiff
path: root/mod/externalpages/actions/edit.php
blob: 184aa3d828e572832e7e8afeeda08c09b770cb4c (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 external pages: create or update
 *
 */

// Get input data and don't filter the content
$contents = get_input('expagescontent', '', false);
$type = get_input('content_type');
$guid = get_input('guid');

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;
if (!$expages->save()) {
	register_error(elgg_echo("expages:error"));
	forward(REFERER);
}

system_message(elgg_echo("expages:posted"));
forward(REFERER);