aboutsummaryrefslogtreecommitdiff
path: root/engine/classes
diff options
context:
space:
mode:
Diffstat (limited to 'engine/classes')
-rw-r--r--engine/classes/ElggEntity.php23
-rw-r--r--engine/classes/ElggMenuItem.php5
-rw-r--r--engine/classes/ElggPAM.php7
-rw-r--r--engine/classes/ElggUser.php8
4 files changed, 31 insertions, 12 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index cfdaede71..79b8c2a4e 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -246,18 +246,20 @@ abstract class ElggEntity extends ElggData implements
* @return mixed The value, or NULL if not found.
*/
public function getMetaData($name) {
- if ((int) ($this->guid) > 0) {
- $md = elgg_get_metadata(array(
- 'guid' => $this->getGUID(),
- 'metadata_name' => $name,
- 'limit' => 0,
- ));
- } else {
+ if ((int) ($this->guid) == 0) {
if (isset($this->temp_metadata[$name])) {
return $this->temp_metadata[$name];
+ } else {
+ return null;
}
}
+ $md = elgg_get_metadata(array(
+ 'guid' => $this->getGUID(),
+ 'metadata_name' => $name,
+ 'limit' => 0,
+ ));
+
if ($md && !is_array($md)) {
return $md->value;
} elseif (count($md) == 1) {
@@ -717,6 +719,9 @@ abstract class ElggEntity extends ElggData implements
*
* @warning By default, annotations are private.
*
+ * @warning Annotating an unsaved entity more than once with the same name
+ * will only save the last annotation.
+ *
* @param string $name Annotation name
* @param mixed $value Annotation value
* @param int $access_id Access ID
@@ -761,8 +766,10 @@ abstract class ElggEntity extends ElggData implements
}
return elgg_get_annotations($options);
+ } else if (isset($this->temp_annotations[$name])) {
+ return array($this->temp_annotations[$name]);
} else {
- return $this->temp_annotations[$name];
+ return array();
}
}
diff --git a/engine/classes/ElggMenuItem.php b/engine/classes/ElggMenuItem.php
index 98a3d7d24..bf6cf2edc 100644
--- a/engine/classes/ElggMenuItem.php
+++ b/engine/classes/ElggMenuItem.php
@@ -127,6 +127,11 @@ class ElggMenuItem {
$item->setLinkClass($options['class']);
unset($options['class']);
}
+
+ if (isset($options['item_class'])) {
+ $item->setItemClass($options['item_class']);
+ unset($options['item_class']);
+ }
foreach ($options as $key => $value) {
$item->$key = $value;
diff --git a/engine/classes/ElggPAM.php b/engine/classes/ElggPAM.php
index 37436fba3..0681a909b 100644
--- a/engine/classes/ElggPAM.php
+++ b/engine/classes/ElggPAM.php
@@ -41,9 +41,14 @@ class ElggPAM {
* @param array $credentials Credentials array dependant on policy type
* @return bool
*/
- public function authenticate($credentials) {
+ public function authenticate($credentials = array()) {
global $_PAM_HANDLERS;
+ if (!isset($_PAM_HANDLERS[$this->policy]) ||
+ !is_array($_PAM_HANDLERS[$this->policy])) {
+ return false;
+ }
+
$authenticated = false;
foreach ($_PAM_HANDLERS[$this->policy] as $k => $v) {
diff --git a/engine/classes/ElggUser.php b/engine/classes/ElggUser.php
index 5c65a4d66..1af4cdc3a 100644
--- a/engine/classes/ElggUser.php
+++ b/engine/classes/ElggUser.php
@@ -59,9 +59,11 @@ class ElggUser extends ElggEntity
// See if this is a username
} else if (is_string($guid)) {
- $guid = get_user_by_username($guid);
- foreach ($guid->attributes as $key => $value) {
- $this->attributes[$key] = $value;
+ $user = get_user_by_username($guid);
+ if ($user) {
+ foreach ($user->attributes as $key => $value) {
+ $this->attributes[$key] = $value;
+ }
}
// Is $guid is an ElggUser? Use a copy constructor