*/
class FriendSuggest extends BaseModule
{
- public static function init(array $parameters = [])
+ public function init()
{
if (!local_user()) {
throw new ForbiddenException(DI::l10n()->t('Permission denied.'));
}
}
- public static function post(array $parameters = [])
+ public function post()
{
- $cid = intval($parameters['contact']);
+ $cid = intval($this->parameters['contact']);
// We do query the "uid" as well to ensure that it is our contact
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
info(DI::l10n()->t('Friend suggestion sent.'));
}
- public static function content(array $parameters = [])
+ public function content(): string
{
- $cid = intval($parameters['contact']);
+ $cid = intval($this->parameters['contact']);
$contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {
DI::baseUrl()->redirect();
}
- $contacts = ContactModel::selectToArray(['id', 'name'], [
+ $suggestableContacts = ContactModel::selectToArray(['id', 'name'], [
'`uid` = ?
AND `id` != ?
AND `network` = ?
$formattedContacts = [];
- foreach ($contacts as $contact) {
- $formattedContacts[$contact['id']] = $contact['name'];
+ foreach ($suggestableContacts as $suggestableContact) {
+ $formattedContacts[$suggestableContact['id']] = $suggestableContact['name'];
}
$tpl = Renderer::getMarkupTemplate('fsuggest.tpl');