use Friendica\Content\PageInfo;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
-use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
+use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Util\Strings;
function ifttt_content() {}
-function ifttt_settings(App $a, array &$data)
+function ifttt_settings(array &$data)
{
- if (!local_user()) {
+ if (!DI::userSession()->getLocalUserId()) {
return;
}
- $key = DI::pConfig()->get(local_user(), 'ifttt', 'key');
+ $key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ifttt', 'key');
if (!$key) {
$key = Strings::getRandomHex(20);
- DI::pConfig()->set(local_user(), 'ifttt', 'key', $key);
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'ifttt', 'key', $key);
}
$t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ifttt/');
'new_photo_upload_body' => DI::l10n()->t('Body for "new photo upload"'),
'new_link_post_body' => DI::l10n()->t('Body for "new link post"'),
],
- '$url' => DI::baseUrl()->get() . '/ifttt/' . $a->getLoggedInUserNickname(),
+ '$url' => DI::baseUrl() . '/ifttt/' . DI::userSession()->getLocalUserNickname(),
'$new_status_message_body' => 'key=' . $key . '&type=status&msg=<<<{{Message}}>>>&date=<<<{{UpdatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_photo_upload_body' => 'key=' . $key . '&type=photo&link=<<<{{Link}}>>>&image=<<<{{ImageSource}}>>>&msg=<<<{{Caption}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
'$new_link_post_body' => 'key=' . $key . '&type=link&link=<<<{{Link}}>>>&title=<<<{{Title}}>>>&msg=<<<{{Message}}>>>&description=<<<{{Description}}>>>&date=<<<{{CreatedAt}}>>>&url=<<<{{PageUrl}}>>>',
function ifttt_settings_post()
{
if (!empty($_POST['ifttt-submit'])) {
- DI::pConfig()->delete(local_user(), 'ifttt', 'key');
+ DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'ifttt', 'key');
}
}
-function ifttt_post(App $a)
+function ifttt_post()
{
if (DI::args()->getArgc() != 2) {
return;
function ifttt_message($uid, $item)
{
- $a = DI::app();
-
$post = [];
$post['uid'] = $uid;
$post['app'] = 'IFTTT';
$link = hash('ripemd128', $item['msg']);
}
- Post\Delayed::add($link, $post, PRIORITY_MEDIUM, Post\Delayed::UNPREPARED);
+ Post\Delayed::add($link, $post, Worker::PRIORITY_MEDIUM, Post\Delayed::PREPARED);
}