From 0335cb39c80d394837c2bb302a358027e0db55bb Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 1 Apr 2011 01:25:25 +0000 Subject: Refs #3245 pulling in https://github.com/Elgg/Elgg/pull/11 and thanks also to gprasanth git-svn-id: http://code.elgg.org/elgg/trunk@8891 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/metastrings.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'engine') diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php index 4218659d9..0d472a18b 100644 --- a/engine/lib/metastrings.php +++ b/engine/lib/metastrings.php @@ -75,7 +75,7 @@ function get_metastring_id($string, $case_sensitive = TRUE) { $ids[] = $metaString->id; } return $ids; - } else { + } else if ($metaStrings) { $row = $metaStrings[0]; } } @@ -429,17 +429,19 @@ function elgg_get_metastring_based_objects($options) { $query .= get_access_sql_suffix('e'); // reverse order by - if ($options['reverse_order_by']) { + if (isset($options['reverse_order_by']) && $options['reverse_order_by']) { $options['order_by'] = elgg_sql_reverse_order_by_clause($options['order_by'], $defaults['order_by']); } if ($options['metastring_calculation'] === ELGG_ENTITIES_NO_VALUE) { - if ($options['group_by'] = sanitise_string($options['group_by'])) { + if (isset($options['group_by'])) { + $options['group_by'] = sanitise_string($options['group_by']); $query .= " GROUP BY {$options['group_by']}"; } - if ($options['order_by'] = sanitise_string($options['order_by'])) { + if (isset($options['order_by']) && $options['order_by']) { + $options['order_by'] = sanitise_string($options['order_by']); $query .= " ORDER BY {$options['order_by']}, n_table.id"; } -- cgit v1.2.3