aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-09-30 12:15:39 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-09-30 12:15:39 +0000
commitfc11bcffa66e2baaae52261a84de13802bb1f072 (patch)
tree4eb0a28e6d836ca17d8486ff68d753202b11d402
parent96713356dc066fc039b445dcf92d874a47d871f0 (diff)
downloadelgg-fc11bcffa66e2baaae52261a84de13802bb1f072.tar.gz
elgg-fc11bcffa66e2baaae52261a84de13802bb1f072.tar.bz2
Closes #388: Additionally the site check in configuration_init() should be instanceof. Nice spot, thanks.
git-svn-id: https://code.elgg.org/elgg/trunk@2151 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--actions/friends/remove.php10
-rw-r--r--engine/lib/configuration.php2
-rw-r--r--engine/lib/users.php2
3 files changed, 10 insertions, 4 deletions
diff --git a/actions/friends/remove.php b/actions/friends/remove.php
index 3d024b9d1..1f3cdcc5b 100644
--- a/actions/friends/remove.php
+++ b/actions/friends/remove.php
@@ -20,8 +20,14 @@
$errors = false;
// Get the user
- try{
- $_SESSION['user']->removeFriend($friend_guid) && get_class($friend) == "ElggUser";
+ try{
+ if ($friend instanceof ElggUser)
+ $_SESSION['user']->removeFriend($friend_guid);
+ else
+ {
+ register_error(sprintf(elgg_echo("friends:remove:failure"),$friend->name));
+ $errors = true;
+ }
} catch (Exception $e) {
register_error(sprintf(elgg_echo("friends:remove:failure"),$friend->name));
$errors = true;
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index bdba96b2b..a034f7efc 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -177,7 +177,7 @@
$dataroot = datalist_get('dataroot');
if (!empty($dataroot))
$CONFIG->dataroot = $dataroot;
- if (isset($CONFIG->site) && (get_class($CONFIG->site) == "ElggSite")) {
+ if (isset($CONFIG->site) && ($CONFIG->site instanceof ElggSite)) {
$CONFIG->wwwroot = $CONFIG->site->url;
$CONFIG->sitename = $CONFIG->site->name;
$CONFIG->sitedescription = $CONFIG->site->description;
diff --git a/engine/lib/users.php b/engine/lib/users.php
index e29a920ff..3bb1d0da8 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -440,7 +440,7 @@
$friend_guid = (int) $friend_guid;
if (!$friend = get_entity($friend_guid)) return false;
if (!$user = get_entity($user_guid)) return false;
- if (get_class($user) != "ElggUser" || get_class($friend) != "ElggUser") return false;
+ if ( (!($user instanceof ElggUser)) || (!($friend instanceof ElggUser)) ) return false;
return add_entity_relationship($user_guid, "friend", $friend_guid);
}