aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/friends/collections/add.php2
-rw-r--r--mod/messages/start.php36
-rw-r--r--views/default/css/admin.php2
-rw-r--r--views/default/css/elements/navigation.php2
-rw-r--r--views/default/output/access.php2
5 files changed, 40 insertions, 4 deletions
diff --git a/actions/friends/collections/add.php b/actions/friends/collections/add.php
index 9dc17b37e..e63a149f7 100644
--- a/actions/friends/collections/add.php
+++ b/actions/friends/collections/add.php
@@ -6,7 +6,7 @@
* @subpackage Friends.Collections
*/
-$collection_name = get_input('collection_name');
+$collection_name = htmlspecialchars(get_input('collection_name', '', false), ENT_QUOTES, 'UTF-8');
$friends = get_input('friends_collection');
if (!$collection_name) {
diff --git a/mod/messages/start.php b/mod/messages/start.php
index 5503a675a..6d0e82744 100644
--- a/mod/messages/start.php
+++ b/mod/messages/start.php
@@ -51,6 +51,9 @@ function messages_init() {
elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'messages_notification_msg');
register_notification_object('object', 'messages', elgg_echo('messages:new'));
+ // delete messages sent by a user when user is deleted
+ elgg_register_event_handler('delete', 'user', 'messages_purge');
+
// ecml
elgg_register_plugin_hook_handler('get_views', 'ecml', 'messages_ecml_views_hook');
@@ -425,6 +428,39 @@ function messages_user_hover_menu($hook, $type, $return, $params) {
return $return;
}
+/**
+ * Delete messages from a user who is being deleted
+ *
+ * @param string $event Event name
+ * @param string $type Event type
+ * @param ElggUser $user User being deleted
+ */
+function messages_purge($event, $type, $user) {
+
+ if (!$user->getGUID()) {
+ return;
+ }
+
+ // make sure we delete them all
+ $entity_disable_override = access_get_show_hidden_status();
+ access_show_hidden_entities(true);
+ $ia = elgg_set_ignore_access(true);
+
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'messages',
+ 'metadata_name' => 'fromId',
+ 'metadata_value' => $user->getGUID(),
+ 'limit' => 0,
+ );
+ $batch = new ElggBatch('elgg_get_entities_from_metadata', $options);
+ foreach ($batch as $e) {
+ $e->delete();
+ }
+
+ elgg_set_ignore_access($ia);
+ access_show_hidden_entities($entity_disable_override);
+}
/**
* Register messages with ECML.
diff --git a/views/default/css/admin.php b/views/default/css/admin.php
index ceeac71a2..8197f29de 100644
--- a/views/default/css/admin.php
+++ b/views/default/css/admin.php
@@ -1003,7 +1003,7 @@ a.elgg-button {
ENTITY MENU
*************************************** */
<?php // height depends on line height/font size ?>
-.elgg-menu-entity, elgg-menu-annotation {
+.elgg-menu-entity, .elgg-menu-annotation {
float: right;
margin-left: 15px;
font-size: 90%;
diff --git a/views/default/css/elements/navigation.php b/views/default/css/elements/navigation.php
index 49e36e494..6b29e4c19 100644
--- a/views/default/css/elements/navigation.php
+++ b/views/default/css/elements/navigation.php
@@ -450,7 +450,7 @@
ENTITY AND ANNOTATION
*************************************** */
<?php // height depends on line height/font size ?>
-.elgg-menu-entity, elgg-menu-annotation {
+.elgg-menu-entity, .elgg-menu-annotation {
float: right;
margin-left: 15px;
font-size: 90%;
diff --git a/views/default/output/access.php b/views/default/output/access.php
index 91c5c721e..5c8d62c4d 100644
--- a/views/default/output/access.php
+++ b/views/default/output/access.php
@@ -11,7 +11,7 @@ if (isset($vars['entity']) && elgg_instanceof($vars['entity'])) {
$access_id = $vars['entity']->access_id;
$access_class = 'elgg-access';
$access_id_string = get_readable_access_level($access_id);
- $access_id_string = htmlentities($access_id_string, ENT_QUOTES, 'UTF-8');
+ $access_id_string = htmlspecialchars($access_id_string, ENT_QUOTES, 'UTF-8', false);
// if within a group or shared access collection display group name and open/closed membership status
// @todo have a better way to do this instead of checking against subtype / class.