aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 13:11:23 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-26 13:11:23 +0000
commit962164b97ca11d9ce155bde60f198d226ff060d3 (patch)
tree84dd5d6f7979a8c4e6efa08dd32c60b9bedffc27
parent83658fe7fe28332e73ca6600793ddb8bb52f5b3a (diff)
downloadelgg-962164b97ca11d9ce155bde60f198d226ff060d3.tar.gz
elgg-962164b97ca11d9ce155bde60f198d226ff060d3.tar.bz2
Fixes #3239 entities aren't blown away in form prepare functions any more
git-svn-id: http://code.elgg.org/elgg/trunk@8839 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--mod/bookmarks/lib/bookmarks.php11
-rw-r--r--mod/bookmarks/views/default/forms/bookmarks/save.php2
-rw-r--r--mod/file/lib/file.php9
-rw-r--r--mod/groups/lib/discussion.php9
-rw-r--r--mod/pages/lib/pages.php9
5 files changed, 26 insertions, 14 deletions
diff --git a/mod/bookmarks/lib/bookmarks.php b/mod/bookmarks/lib/bookmarks.php
index 815330e2c..9a9dff18c 100644
--- a/mod/bookmarks/lib/bookmarks.php
+++ b/mod/bookmarks/lib/bookmarks.php
@@ -14,7 +14,7 @@
function bookmarks_prepare_form_vars($bookmark = null) {
// input names => defaults
$values = array(
- 'title' => get_input('title', ''),
+ 'title' => get_input('title', ''), // bookmarklet support
'address' => get_input('address', ''),
'description' => '',
'access_id' => ACCESS_DEFAULT,
@@ -27,13 +27,16 @@ function bookmarks_prepare_form_vars($bookmark = null) {
if ($bookmark) {
foreach (array_keys($values) as $field) {
- $values[$field] = $bookmark->$field;
+ if (isset($bookmark->$field)) {
+ $values[$field] = $bookmark->$field;
+ }
}
}
if (elgg_is_sticky_form('bookmarks')) {
- foreach (array_keys($values) as $field) {
- $values[$field] = elgg_get_sticky_value('bookmarks', $field);
+ $sticky_values = elgg_get_sticky_values('bookmarks');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
}
}
diff --git a/mod/bookmarks/views/default/forms/bookmarks/save.php b/mod/bookmarks/views/default/forms/bookmarks/save.php
index 4930aacdb..886283202 100644
--- a/mod/bookmarks/views/default/forms/bookmarks/save.php
+++ b/mod/bookmarks/views/default/forms/bookmarks/save.php
@@ -5,7 +5,7 @@
* @package Bookmarks
*/
-// once elgg_view stops throwing all sorts of junk into $vars, we can use
+// once elgg_view stops throwing all sorts of junk into $vars, we can use extract()
$title = elgg_extract('title', $vars, '');
$desc = elgg_extract('description', $vars, '');
$address = elgg_extract('address', $vars, '');
diff --git a/mod/file/lib/file.php b/mod/file/lib/file.php
index 6ca49e95b..6f94772e7 100644
--- a/mod/file/lib/file.php
+++ b/mod/file/lib/file.php
@@ -26,13 +26,16 @@ function file_prepare_form_vars($file = null) {
if ($file) {
foreach (array_keys($values) as $field) {
- $values[$field] = $file->$field;
+ if (isset($file->$field)) {
+ $values[$field] = $file->$field;
+ }
}
}
if (elgg_is_sticky_form('file')) {
- foreach (array_keys($values) as $field) {
- $values[$field] = elgg_get_sticky_value('file', $field);
+ $sticky_values = elgg_get_sticky_values('file');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
}
}
diff --git a/mod/groups/lib/discussion.php b/mod/groups/lib/discussion.php
index 1813c87aa..94d212ef6 100644
--- a/mod/groups/lib/discussion.php
+++ b/mod/groups/lib/discussion.php
@@ -218,13 +218,16 @@ function discussion_prepare_form_vars($topic = NULL) {
if ($topic) {
foreach (array_keys($values) as $field) {
- $values[$field] = $topic->$field;
+ if (isset($topic->$field)) {
+ $values[$field] = $topic->$field;
+ }
}
}
if (elgg_is_sticky_form('topic')) {
- foreach (array_keys($values) as $field) {
- $values[$field] = elgg_get_sticky_value('topic', $field);
+ $sticky_values = elgg_get_sticky_values('topic');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
}
}
diff --git a/mod/pages/lib/pages.php b/mod/pages/lib/pages.php
index 079155190..0a6f3a620 100644
--- a/mod/pages/lib/pages.php
+++ b/mod/pages/lib/pages.php
@@ -26,13 +26,16 @@ function pages_prepare_form_vars($page = null, $parent_guid = 0) {
if ($page) {
foreach (array_keys($values) as $field) {
- $values[$field] = $page->$field;
+ if (isset($page->$field)) {
+ $values[$field] = $page->$field;
+ }
}
}
if (elgg_is_sticky_form('page')) {
- foreach (array_keys($values) as $field) {
- $values[$field] = elgg_get_sticky_value('page', $field);
+ $sticky_values = elgg_get_sticky_values('page');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
}
}