diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/admin.php | 3 | ||||
-rw-r--r-- | engine/lib/entities.php | 2 | ||||
-rw-r--r-- | engine/lib/metadata.php | 2 | ||||
-rw-r--r-- | engine/lib/sessions.php | 2 | ||||
-rw-r--r-- | engine/lib/users.php | 17 |
5 files changed, 20 insertions, 6 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 47704a4be..974f6b35d 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -47,7 +47,8 @@ register_action('admin/user/ban', false, "", true); register_action('admin/user/delete', false, "", true); - register_action('admin/user/resetpassword', false, "", true); + register_action('admin/user/resetpassword', false, "", true);
+ register_action('admin/user/makeadmin', false, "", true); // Register some actions register_action('admin/site/update_basic', false, "", true); // Register basic site admin action diff --git a/engine/lib/entities.php b/engine/lib/entities.php index abbd67bab..47ff916f8 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1357,7 +1357,7 @@ if ($entity = get_entity($entity_guid)) {
$return = can_edit_entity($entity_guid, $user_guid);
- $return = trigger_plugin_hook('permissions_check:metadata',$entity->type,null,$return);
+ $return = trigger_plugin_hook('permissions_check:metadata',$entity->type,array('entity' => $entity, 'user' => $user),$return);
return $return;
} else {
return false;
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php index 130749bdd..1a8c58a2e 100644 --- a/engine/lib/metadata.php +++ b/engine/lib/metadata.php @@ -118,7 +118,7 @@ */ public function getObjectFromID($id) { return get_metadata($id); } }
- + /** * Convert a database row to a new ElggMetadata * diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index 3116f500d..320813289 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -204,7 +204,7 @@ }
}
if ($_SESSION['id'] > 0) {
- // set_last_action($_SESSION['id']);
+ set_last_action($_SESSION['id']);
}
register_action("login",true);
diff --git a/engine/lib/users.php b/engine/lib/users.php index cec5c87c7..229735960 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -769,8 +769,7 @@ $time = time() - $seconds; - //$query = "SELECT * from {$CONFIG->dbprefix}entities where type='user' and time_updated>=$time order by time_updated desc limit $offset, $limit"; - $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}system_log s on e.guid=s.performed_by_guid where e.type='user' and s.time_created>=$time order by s.time_created desc limit $offset,$limit"; + $query = "SELECT distinct e.* from {$CONFIG->dbprefix}entities e join {$CONFIG->dbprefix}users_entity u on e.guid = u.guid where u.last_action >= {$time} order by u.last_action desc limit {$offset},{$limit}"; return get_data($query, "entity_row_to_elggstar"); } @@ -939,6 +938,20 @@ require_once(dirname(dirname(dirname(__FILE__))) . "/friends/of.php");
}
+
+ /**
+ * Sets the last action time of the given user to right now.
+ *
+ * @param int $user_guid The user GUID
+ */
+ function set_last_action($user_guid) {
+
+ $user_guid = (int) $user_guid;
+ global $CONFIG;
+ $time = time();
+ update_data("update {$CONFIG->dbprefix}users_entity set prev_last_action = last_action, last_action = {$time} where guid = {$user_guid}");
+
+ }
/**
* Users initialisation function, which establishes the page handler
|