* Extend this method if the module is supposed to return communication data,
* e.g. from protocol implementations.
*/
- public static function rawContent()
+ public static function rawContent($parameters)
{
// echo '';
// exit;
*/
class AccountManagementControlDocument extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$output = [
'version' => 1,
class PhpInfo extends BaseAdminModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
- parent::rawContent();
+ parent::rawContent($parameters);
phpinfo();
exit();
/**
* @brief Return to user an attached file given the id
*/
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
if ($a->argc != 2) {
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
if (!is_site_admin()) {
return '';
*/
class Hovercard extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$contact_url = $_REQUEST['url'] ?? '';
*/
class Fetch extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
$logger = $a->getLogger();
*/
class Followers extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
*/
class Following extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
]);
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
*/
class Inbox extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
*/
class Ignore extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
/** @var L10n $l10n */
$l10n = self::getClass(L10n::class);
*/
class Like extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();
class Manifest extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
*/
class Objects extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
/**
* @throws \Exception
*/
- public static function rawContent()
+ public static function rawContent($parameters)
{
header('Content-type: application/opensearchdescription+xml');
*/
class Outbox extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$a = self::getApp();
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
*/
class PublicRSAKey extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
*/
class ReallySimpleDiscovery extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
header('Content-Type: text/xml');
*/
class RobotsTxt extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$allDisalloweds = [
'/settings/',
const TYPE_PRIVATE_MESSAGE = 'm';
const TYPE_ANY_CONTACT = 'a';
- public static function rawContent()
+ public static function rawContent($parameters)
{
if (!local_user()) {
throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this module.'));
* to the browser which then offers a save / open dialog
* to the user.
**/
- public static function rawContent()
+ public static function rawContent($parameters)
{
$args = self::getClass(Arguments::class);
if ($args->getArgc() == 3) {
*/
class Smilies extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
use Friendica\BaseModule;
use Friendica\Model\Item;
+use Friendica\Core\System;
/**
* Toggle starred items
*/
class Starred extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
- $a = self::getApp();
- $starred = 0;
- $itemId = null;
-
if (!local_user()) {
exit();
}
- // @TODO: Replace with parameter from router
- if ($a->argc > 1) {
- $itemId = intval($a->argv[1]);
- }
-
- if (!$itemId) {
- exit();
+ if (empty($parameters['item'])) {
+ exit;
+ } else {
+ $itemId = intval($parameters['item']);
}
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]);
exit();
}
- if (!intval($item['starred'])) {
- $starred = 1;
- }
+ $starred = !$item['starred'];
Item::update(['starred' => $starred], ['id' => $itemId]);
// See if we've been passed a return path to redirect to
$returnPath = $_REQUEST['return'] ?? '';
- if ($returnPath) {
- $rand = '_=' . time();
- if (strpos($returnPath, '?')) {
- $rand = "&$rand";
- } else {
- $rand = "?$rand";
- }
-
- $a->internalRedirect($returnPath . $rand);
+ if (!empty($returnPath)) {
+ $rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
+ self::getApp()->internalRedirect($returnPath . $rand);
}
// the json doesn't really matter, it will either be 0 or 1
- echo json_encode($starred);
- exit();
+ System::jsonExit($starred);
}
}
}
}
- public static function rawContent()
+ public static function rawContent($parameters)
{
$config = self::getApp()->getConfig();
$logger = self::getApp()->getLogger();
*/
class Theme extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
header("Content-Type: text/css");
*/
class ThemeDetails extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
if (!empty($_REQUEST['theme'])) {
$theme = $_REQUEST['theme'];
*/
class HostMeta extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();
*/
class XSocialRelay extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();
*/
class Xrd extends BaseModule
{
- public static function rawContent()
+ public static function rawContent($parameters)
{
$app = self::getApp();
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1323);
+ define('DB_UPDATE_VERSION', 1324);
}
return [
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
- "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"]
+ "ignored" => ["type" => "boolean", "comment" => "Ignore this thread if set"],
+ "pinned" => ["type" => "boolean", "comment" => "The item is pinned on the profile page"]
],
"indexes" => [
"PRIMARY" => ["uid", "iid"]
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
],
- '/pretheme' => [Module\ThemeDetails::class, [R::GET]],
- '/probe' => [Module\Debug\Probe::class, [R::GET]],
+ '/pinned/{item:\d+}' => [Module\Pinned::class, [R::GET]],
+ '/pretheme' => [Module\ThemeDetails::class, [R::GET]],
+ '/probe' => [Module\Debug\Probe::class, [R::GET]],
'/profile' => [
'/{nickname}' => [Module\Profile::class, [R::GET]],