friendica/src/Module/FollowConfirm.php
Philipp 8bdd90066f
Make BaseModule a real entity
- Add all dependencies, necessary to run the content (baseUrl, Arguments)
- Encapsulate all POST/GET/DELETE/PATCH/PUT methods as protected methods inside the BaseModule
- Return Module content ONLY per `BaseModule::run()` (including the Hook logic there as well)
2021-11-27 12:40:36 +01:00

34 lines
753 B
PHP

<?php
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\DI;
use Friendica\Model\Contact;
/**
* Process follow request confirmations
*/
class FollowConfirm extends BaseModule
{
protected function post(array $request = [], array $post = [])
{
parent::post($post);
$uid = local_user();
if (!$uid) {
notice(DI::l10n()->t('Permission denied.'));
return;
}
$intro_id = intval($_POST['intro_id'] ?? 0);
$duplex = intval($_POST['duplex'] ?? 0);
$hidden = intval($_POST['hidden'] ?? 0);
$intro = DI::intro()->selectOneById($intro_id, local_user());
Contact\Introduction::confirm($intro, $duplex, $hidden);
DI::intro()->delete($intro);
DI::baseUrl()->redirect('contact/' . $intro->cid);
}
}