aboutsummaryrefslogtreecommitdiff
path: root/mod/externalpages/actions/edit.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/externalpages/actions/edit.php')
-rw-r--r--mod/externalpages/actions/edit.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/mod/externalpages/actions/edit.php b/mod/externalpages/actions/edit.php
new file mode 100644
index 000000000..184aa3d82
--- /dev/null
+++ b/mod/externalpages/actions/edit.php
@@ -0,0 +1,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);