diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/elgglib.php | 4 | ||||
-rw-r--r-- | engine/lib/users.php | 49 |
2 files changed, 27 insertions, 26 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index dd7f877dd..94959496e 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -432,12 +432,12 @@ * @return array Array of full filenames
*/
function get_library_files($directory, $file_exceptions = array(), $file_list = array()) {
-
+ $extensions_allowed = array('.php');
if (is_file($directory) && !in_array($directory,$file_exceptions)) {
$file_list[] = $directory;
} else if ($handle = opendir($directory)) {
while ($file = readdir($handle)) {
- if (!in_array($file,$file_exceptions)) {
+ if (in_array(strrchr($file, '.'), $extensions_allowed) && !in_array($file,$file_exceptions)) {
$file_list = get_library_files($directory . "/" . $file, $file_exceptions, $file_list);
}
}
diff --git a/engine/lib/users.php b/engine/lib/users.php index cdd7f9a3d..68383d8e5 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -58,7 +58,7 @@ // Is $guid is a DB row - either a entity row, or a user table row.
if ($guid instanceof stdClass) {
// Load the rest
- if (!$this->load($guid->guid)) + if (!$this->load($guid->guid))
throw new IOException("Failed to load new ElggUser from GUID:$guid->guid");
}
@@ -261,7 +261,7 @@ public function getCollections($subtype="", $limit = 10, $offset = 0) { return get_user_collections($this->getGUID(), $subtype, $limit, $offset); }
}
- +
/**
* Return the user specific details of a user by a row.
*
@@ -417,27 +417,28 @@ $ntt = get_entities('object',$subtype, $user_guid, "time_created desc", $limit, $offset);
return $ntt;
}
- - /** - * Get a user object from a GUID. - * - * This function returns an ElggUser from a given GUID. - * @param int $guid The GUID - * @return ElggUser|false - * @throws InvalidParameterException if $GUID exists but is not an ElggUser. - */ - function get_user($guid) - { - $result = get_entity($guid); - - if (($result) && (!($result instanceof ElggUser))) - throw new InvalidParameterException("GUID:$guid is not an ElggUser"); - - if ($result) - return $result; - - return false; - } +
+ /**
+ * Get a user object from a GUID.
+ *
+ * This function returns an ElggUser from a given GUID.
+ * @param int $guid The GUID
+ * @return ElggUser|false
+ * @throws InvalidParameterException if $GUID exists but is not an ElggUser.
+ */
+ function get_user($guid)
+ {
+ if (!empty($guid)) // Fixes "Exception thrown without stack frame" when db_select fails
+ $result = get_entity($guid);
+
+ if (($result) && (!($result instanceof ElggUser)))
+ throw new InvalidParameterException("GUID:$guid is not an ElggUser");
+
+ if ($result)
+ return $result;
+
+ return false;
+ }
/**
* Get user by username
@@ -474,7 +475,7 @@ return new ElggUser($row);
return false;
- } + }
/**
* Registers a user, returning false if the username already exists
|