diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/elgglib.php | 4 | ||||
-rw-r--r-- | engine/lib/users.php | 49 | ||||
-rw-r--r-- | engine/start.php | 32 |
3 files changed, 47 insertions, 38 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
diff --git a/engine/start.php b/engine/start.php index 956f0ac3e..a3386f309 100644 --- a/engine/start.php +++ b/engine/start.php @@ -14,20 +14,28 @@ /**
* Load important prerequisites
- */ - - if (!@include_once(dirname(__FILE__) . "/lib/exceptions.php")) { // Exceptions - echo "Error in installation: could not load the Exceptions library."; - exit; + */
+
+ if (!@include_once(dirname(__FILE__) . "/lib/exceptions.php")) { // Exceptions
+ echo "Error in installation: could not load the Exceptions library.";
+ exit;
}
if (!@include_once(dirname(__FILE__) . "/lib/elgglib.php")) { // Main Elgg library
throw new InstallationException("Elgg could not load its main library.");
- } - - if (!@include_once(dirname(__FILE__) . "/lib/export.php")) { // Export library - echo "Error in installation: could not load the Export library."; - exit; + }
+
+ if (!@include_once(dirname(__FILE__) . "/lib/actions.php")) {
+ throw new InstallationException("Elgg could not load the Actions library");
+ }
+
+ if (!@include_once(dirname(__FILE__) . "/lib/sessions.php")) {
+ throw new InstallationException("Elgg could not load the Sessions library");
+ }
+
+ if (!@include_once(dirname(__FILE__) . "/lib/export.php")) { // Export library
+ echo "Error in installation: could not load the Export library.";
+ exit;
}
/**
@@ -68,9 +76,9 @@ $file_exceptions = array(
'.','..',
- '.svn', + '.svn',
'CVS','cvs',
- 'settings.php','settings.example.php','elgglib.php','database.php'
+ 'settings.php','settings.example.php','exceptions.php','elgglib.php','database.php','actions.php','sessions.php'
);
// Get the list of files to include, and alphabetically sort them
|