]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4069 reusing the previous ElggObject for external pages
authorCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 00:48:36 +0000 (19:48 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 24 Dec 2011 00:48:36 +0000 (19:48 -0500)
mod/externalpages/actions/edit.php
mod/externalpages/views/default/expages/menu.php
mod/externalpages/views/default/forms/expages/edit.php

index edfffe168317275da75ddaedb9306ee98450a11e..184aa3d828e572832e7e8afeeda08c09b770cb4c 100644 (file)
@@ -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;
index 6ed521629edf8c18abdc62ec0c573c038069f95a..831be91255b99befadf5482d41a24a55d4506a08 100644 (file)
@@ -7,8 +7,8 @@
 
 $type = $vars['type'];
 
- //set the url
- $url = $vars['url'] . "admin/site/expages?type=";
+//set the url
+$url = $vars['url'] . "admin/site/expages?type=";
  
 $pages = array('about', 'terms', 'privacy');
 $tabs = array();
index ca83ea7dfda04efcbb5f3d049932c761f8a072ec..a15f2a7aa409385e66d894dbd8bb949ba68641a4 100644 (file)
@@ -50,9 +50,9 @@ echo <<<EOT
        $input_area
 </div>
 <div class="elgg-foot">
-$hidden_value
+$hidden_guid
 $hidden_type
 $submit_input
-<div>
+</div>
 EOT;