3 namespace Friendica\Module;
5 use Friendica\BaseModule;
6 use Friendica\Model\Item;
11 class Pinned extends BaseModule
13 public static function rawContent($parameters)
23 // @TODO: Replace with parameter from router
25 $itemId = intval($a->argv[1]);
32 $item = Item::selectFirstForUser(local_user(), ['pinned'], ['uid' => local_user(), 'id' => $itemId]);
37 if (!intval($item['pinned'])) {
41 Item::update(['pinned' => $pinned], ['id' => $itemId]);
43 // See if we've been passed a return path to redirect to
44 $returnPath = $_REQUEST['return'] ?? '';
46 $rand = '_=' . time();
47 if (strpos($returnPath, '?')) {
53 $a->internalRedirect($returnPath . $rand);
56 // the json doesn't really matter, it will either be 0 or 1
57 echo json_encode($pinned);