|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
include_once "$PROJECT_ROOT/languages/language_flags.php";
|
|
|
|
|
|
|
|
|
|
$WEEK_SECONDS = 604800;
|
|
|
|
@ -131,6 +130,33 @@
|
|
|
|
|
}, $details);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sorts Community rooms in-place by the given string property.
|
|
|
|
|
* @param \CommunityRoom[] $rooms Rooms to sort by given key.
|
|
|
|
|
* @param string $key String property of CommunityRoom to sort by.
|
|
|
|
|
*/
|
|
|
|
|
public static function sort_rooms_str(array &$rooms, string $key) {
|
|
|
|
|
usort($rooms, function(\CommunityRoom $a, \CommunityRoom $b) use ($key) {
|
|
|
|
|
return strcmp(
|
|
|
|
|
$a->$key,
|
|
|
|
|
$b->$key
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sorts Community rooms in-place by their server's public key.
|
|
|
|
|
* @param \CommunityRoom[] $rooms Rooms to sort by server pubkey.
|
|
|
|
|
*/
|
|
|
|
|
public static function sort_rooms_by_pubkey(array &$rooms) {
|
|
|
|
|
usort($rooms, function(\CommunityRoom $a, \CommunityRoom $b) {
|
|
|
|
|
return strcmp(
|
|
|
|
|
$a->server->get_pubkey(),
|
|
|
|
|
$b->server->get_pubkey()
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Returns array of staff Session IDs.
|
|
|
|
|
* @return string[]
|
|
|
|
|