aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-10 11:01:49 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-10 11:01:49 +0000
commit48c29f1d2217fed8db865ed32d2e7c226da85d06 (patch)
treea2245b75c7eb341e80d078fd2fcf6557827dcbc1 /engine/lib/entities.php
parent1124c6e9a16cdc5b9f7d31499faefbccaccdab7a (diff)
downloadelgg-48c29f1d2217fed8db865ed32d2e7c226da85d06.tar.gz
elgg-48c29f1d2217fed8db865ed32d2e7c226da85d06.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Bugfixed canEdit and isFullyLoaded git-svn-id: https://code.elgg.org/elgg/trunk@844 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index f95993dcb..7dcfc5f85 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -409,7 +409,7 @@
*
* @return bool
*/
- public function isFullyLoaded() { return $this->attributes['tables_split'] == $this->attributes['tables_loaded']; }
+ public function isFullyLoaded() { return ! ($this->attributes['tables_loaded'] < $this->attributes['tables_split']); }
/**
* Save generic attributes to the entities table.
@@ -709,7 +709,7 @@
{
global $ENTITY_CACHE;
- $ENTITY_CACHE[$entity->guid] = &$entity;
+ $ENTITY_CACHE[$entity->guid] = $entity;
}
/**
@@ -871,17 +871,16 @@
*/
function update_entity($guid, $owner_guid, $access_id)
{
- global $CONFIG;
+ global $CONFIG, $ENTITY_CACHE;
$guid = (int)$guid;
$owner_guid = (int)$owner_guid;
$access_id = (int)$access_id;
$time = time();
-
+
$entity = get_entity($guid);
if ($entity->canEdit()) {
-
if (trigger_event('update',$entity->type,$entity)) {
$ret = update_data("UPDATE {$CONFIG->dbprefix}entities set owner_guid='$owner_guid', access_id='$access_id', time_updated='$time' WHERE guid=$guid");
@@ -1226,26 +1225,25 @@
* @return true|false Whether the specified user can edit the specified entity.
*/
function can_edit_entity($entity_guid, $user_guid = 0) {
-
+ echo "e_guid:$entity_guid, u_guid:$user_guid";
if ($user_guid == 0) {
- if (isset($_SESSION['user'])) {
+
+ if (isset($_SESSION['user'])) {
$user = $_SESSION['user'];
- } else {
+ } else {
$user = null;
}
- } else {
+ } else {
$user = get_entity($user_guid);
}
if (($entity = get_entity($entity_guid)) && (!is_null($user))) {
-
if ($entity->getOwner() == $user->getGUID()) return true;
if ($entity->type == "user" && $entity->getGUID() == $user->getGUID()) return true;
return trigger_plugin_hook('permissions_check',$entity->type,array('entity' => $entity, 'user' => $user),false);
- } else {
-
+ } else {
return false;
}