Loading Controllers/Cli/Notification.php 0 → 100644 +77 −0 Original line number Original line Diff line number Diff line <?php namespace Minds\Controllers\Cli; use Minds\Cli; use Minds\Core\Events\Dispatcher; use Minds\Interfaces; class Notification extends Cli\Controller implements Interfaces\CliControllerInterface { public function help($command = null) { switch ($command) { case 'send': $this->out('Send a notification'); $this->out('--namespace=<type> Notification namespace'); $this->out('--to=<user guid> User to send notification to'); $this->out('--from=<entity guid> Entity notification is from (defaults to system user)'); $this->out('--view=<view> Notification view'); $this->out('--params=<params> JSON payload data'); // no break default: $this->out('Syntax usage: cli notification <cmd>'); $this->displayCommandHelp(); } } public function exec() { $this->help(); } public function send() { $namespace = $this->getOpt('namespace'); $to = $this->getOpt('to'); $from = $this->getOpt('from') ?? \Minds\Core\Notification\Notification::SYSTEM_ENTITY; $view = $this->getOpt('view'); $params = $this->getOpt('params') ?? '{}'; if (is_null($namespace)) { $this->out('namespace must be set'); return; } if (is_null($to)) { $this->out('to must be set'); return; } if (is_null($view)) { $this->out('view must be set'); return; } $paramsDecoded = json_decode($params, true); if (is_null($paramsDecoded)) { $this->out('Params is not valid JSON'); return; } $eventParams = [ 'to' => [$to], 'from' => $from, 'notification_view' => $view, 'params' => $paramsDecoded ]; $sent = Dispatcher::trigger('notification', $namespace, $eventParams); if ($sent) { $this->out('Notification sent'); } else { $this->out('Error sending notification - is from guid valid?'); } } } Controllers/api/v1/admin/reports.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,7 @@ class reports implements Interfaces\Api, Interfaces\ApiAdminPam /** @var Core\Reports\Repository $repository */ /** @var Core\Reports\Repository $repository */ $repository = Di::_()->get('Reports\Repository'); $repository = Di::_()->get('Reports\Repository'); $reports = $repository->getAll([ $reports = $repository->getList([ 'state' => $state, 'state' => $state, 'limit' => $limit, 'limit' => $limit, 'offset' => $offset 'offset' => $offset Loading Controllers/api/v2/feeds/container.php +3 −0 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,9 @@ class container implements Interfaces\Api case 'blogs': case 'blogs': $type = 'object:blog'; $type = 'object:blog'; break; break; case 'all': $type = 'all'; break; } } $hardLimit = 5000; $hardLimit = 5000; Loading Controllers/api/v2/payments/stripe/connect.php +7 −0 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,14 @@ class connect implements Interfaces\Api $connectManager = new Stripe\Connect\Manager(); $connectManager = new Stripe\Connect\Manager(); try { $account = $connectManager->getByUser($user); $account = $connectManager->getByUser($user); } catch (\Exception $e) { return Factory::response([ 'status' => 'error', 'message' => 'There was an error returning the usd account', ]); } return Factory::response([ return Factory::response([ 'account' => $account->export(), 'account' => $account->export(), Loading Controllers/api/v2/payments/stripe/connect/photoid.php 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line <?php /** * */ namespace Minds\Controllers\api\v2\payments\stripe\connect; use Minds\Api\Factory; use Minds\Common\Cookie; use Minds\Core\Di\Di; use Minds\Core\Config; use Minds\Core\Session; use Minds\Interfaces; use Minds\Core\Payments\Stripe; class photoid implements Interfaces\Api { public function get($pages) { return Factory::response([]); } public function post($pages) { $user = Session::getLoggedInUser(); $connectManager = new Stripe\Connect\Manager(); $account = $connectManager->getByUser($user); $fp = fopen($_FILES['file']['tmp_name'], 'r'); $connectManager->addPhotoId($account, $fp); return Factory::response([ 'account_id' => $account->getId() ]); } public function put($pages) { return Factory::response([]); } public function delete($pages) { return Factory::response([]); } } Loading
Controllers/Cli/Notification.php 0 → 100644 +77 −0 Original line number Original line Diff line number Diff line <?php namespace Minds\Controllers\Cli; use Minds\Cli; use Minds\Core\Events\Dispatcher; use Minds\Interfaces; class Notification extends Cli\Controller implements Interfaces\CliControllerInterface { public function help($command = null) { switch ($command) { case 'send': $this->out('Send a notification'); $this->out('--namespace=<type> Notification namespace'); $this->out('--to=<user guid> User to send notification to'); $this->out('--from=<entity guid> Entity notification is from (defaults to system user)'); $this->out('--view=<view> Notification view'); $this->out('--params=<params> JSON payload data'); // no break default: $this->out('Syntax usage: cli notification <cmd>'); $this->displayCommandHelp(); } } public function exec() { $this->help(); } public function send() { $namespace = $this->getOpt('namespace'); $to = $this->getOpt('to'); $from = $this->getOpt('from') ?? \Minds\Core\Notification\Notification::SYSTEM_ENTITY; $view = $this->getOpt('view'); $params = $this->getOpt('params') ?? '{}'; if (is_null($namespace)) { $this->out('namespace must be set'); return; } if (is_null($to)) { $this->out('to must be set'); return; } if (is_null($view)) { $this->out('view must be set'); return; } $paramsDecoded = json_decode($params, true); if (is_null($paramsDecoded)) { $this->out('Params is not valid JSON'); return; } $eventParams = [ 'to' => [$to], 'from' => $from, 'notification_view' => $view, 'params' => $paramsDecoded ]; $sent = Dispatcher::trigger('notification', $namespace, $eventParams); if ($sent) { $this->out('Notification sent'); } else { $this->out('Error sending notification - is from guid valid?'); } } }
Controllers/api/v1/admin/reports.php +1 −1 Original line number Original line Diff line number Diff line Loading @@ -31,7 +31,7 @@ class reports implements Interfaces\Api, Interfaces\ApiAdminPam /** @var Core\Reports\Repository $repository */ /** @var Core\Reports\Repository $repository */ $repository = Di::_()->get('Reports\Repository'); $repository = Di::_()->get('Reports\Repository'); $reports = $repository->getAll([ $reports = $repository->getList([ 'state' => $state, 'state' => $state, 'limit' => $limit, 'limit' => $limit, 'offset' => $offset 'offset' => $offset Loading
Controllers/api/v2/feeds/container.php +3 −0 Original line number Original line Diff line number Diff line Loading @@ -58,6 +58,9 @@ class container implements Interfaces\Api case 'blogs': case 'blogs': $type = 'object:blog'; $type = 'object:blog'; break; break; case 'all': $type = 'all'; break; } } $hardLimit = 5000; $hardLimit = 5000; Loading
Controllers/api/v2/payments/stripe/connect.php +7 −0 Original line number Original line Diff line number Diff line Loading @@ -20,7 +20,14 @@ class connect implements Interfaces\Api $connectManager = new Stripe\Connect\Manager(); $connectManager = new Stripe\Connect\Manager(); try { $account = $connectManager->getByUser($user); $account = $connectManager->getByUser($user); } catch (\Exception $e) { return Factory::response([ 'status' => 'error', 'message' => 'There was an error returning the usd account', ]); } return Factory::response([ return Factory::response([ 'account' => $account->export(), 'account' => $account->export(), Loading
Controllers/api/v2/payments/stripe/connect/photoid.php 0 → 100644 +41 −0 Original line number Original line Diff line number Diff line <?php /** * */ namespace Minds\Controllers\api\v2\payments\stripe\connect; use Minds\Api\Factory; use Minds\Common\Cookie; use Minds\Core\Di\Di; use Minds\Core\Config; use Minds\Core\Session; use Minds\Interfaces; use Minds\Core\Payments\Stripe; class photoid implements Interfaces\Api { public function get($pages) { return Factory::response([]); } public function post($pages) { $user = Session::getLoggedInUser(); $connectManager = new Stripe\Connect\Manager(); $account = $connectManager->getByUser($user); $fp = fopen($_FILES['file']['tmp_name'], 'r'); $connectManager->addPhotoId($account, $fp); return Factory::response([ 'account_id' => $account->getId() ]); } public function put($pages) { return Factory::response([]); } public function delete($pages) { return Factory::response([]); } }