Added parameter to rawContent
This commit is contained in:
parent
30e02beb46
commit
abe6724629
|
@ -32,7 +32,7 @@ abstract class BaseModule extends BaseObject
|
||||||
* Extend this method if the module is supposed to return communication data,
|
* Extend this method if the module is supposed to return communication data,
|
||||||
* e.g. from protocol implementations.
|
* e.g. from protocol implementations.
|
||||||
*/
|
*/
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
// echo '';
|
// echo '';
|
||||||
// exit;
|
// exit;
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\BaseModule;
|
||||||
*/
|
*/
|
||||||
class AccountManagementControlDocument extends BaseModule
|
class AccountManagementControlDocument extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$output = [
|
$output = [
|
||||||
'version' => 1,
|
'version' => 1,
|
||||||
|
|
|
@ -6,9 +6,9 @@ use Friendica\Module\BaseAdminModule;
|
||||||
|
|
||||||
class PhpInfo extends BaseAdminModule
|
class PhpInfo extends BaseAdminModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
parent::rawContent();
|
parent::rawContent($parameters);
|
||||||
|
|
||||||
phpinfo();
|
phpinfo();
|
||||||
exit();
|
exit();
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Attach extends BaseModule
|
||||||
/**
|
/**
|
||||||
* @brief Return to user an attached file given the id
|
* @brief Return to user an attached file given the id
|
||||||
*/
|
*/
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
if ($a->argc != 2) {
|
if ($a->argc != 2) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ abstract class BaseAdminModule extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
if (!is_site_admin()) {
|
if (!is_site_admin()) {
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -18,7 +18,7 @@ use Friendica\Util\Proxy;
|
||||||
*/
|
*/
|
||||||
class Hovercard extends BaseModule
|
class Hovercard extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$contact_url = $_REQUEST['url'] ?? '';
|
$contact_url = $_REQUEST['url'] ?? '';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Fetch extends BaseModule
|
class Fetch extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class SaveTag extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
$logger = $a->getLogger();
|
$logger = $a->getLogger();
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
*/
|
*/
|
||||||
class Followers extends BaseModule
|
class Followers extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
*/
|
*/
|
||||||
class Following extends BaseModule
|
class Following extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Friendica extends BaseModule
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ use Friendica\Util\Network;
|
||||||
*/
|
*/
|
||||||
class Inbox extends BaseModule
|
class Inbox extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use Friendica\Network\HTTPException;
|
||||||
*/
|
*/
|
||||||
class Ignore extends BaseModule
|
class Ignore extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
/** @var L10n $l10n */
|
/** @var L10n $l10n */
|
||||||
$l10n = self::getClass(L10n::class);
|
$l10n = self::getClass(L10n::class);
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Like extends BaseModule
|
class Like extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
if (!Session::isAuthenticated()) {
|
if (!Session::isAuthenticated()) {
|
||||||
throw new HTTPException\ForbiddenException();
|
throw new HTTPException\ForbiddenException();
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\Core\Renderer;
|
||||||
|
|
||||||
class Manifest extends BaseModule
|
class Manifest extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
$config = $app->getConfig();
|
$config = $app->getConfig();
|
||||||
|
|
|
@ -22,7 +22,7 @@ class NodeInfo extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Notify extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
*/
|
*/
|
||||||
class Objects extends BaseModule
|
class Objects extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class OpenSearch extends BaseModule
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
header('Content-type: application/opensearchdescription+xml');
|
header('Content-type: application/opensearchdescription+xml');
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
*/
|
*/
|
||||||
class Outbox extends BaseModule
|
class Outbox extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Profile extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
if (ActivityPub::isRequest()) {
|
if (ActivityPub::isRequest()) {
|
||||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
|
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Network\HTTPException\BadRequestException;
|
||||||
*/
|
*/
|
||||||
class PublicRSAKey extends BaseModule
|
class PublicRSAKey extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Util\XML;
|
||||||
*/
|
*/
|
||||||
class ReallySimpleDiscovery extends BaseModule
|
class ReallySimpleDiscovery extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
header('Content-Type: text/xml');
|
header('Content-Type: text/xml');
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\BaseModule;
|
||||||
*/
|
*/
|
||||||
class RobotsTxt extends BaseModule
|
class RobotsTxt extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$allDisalloweds = [
|
$allDisalloweds = [
|
||||||
'/settings/',
|
'/settings/',
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Acl extends BaseModule
|
||||||
const TYPE_PRIVATE_MESSAGE = 'm';
|
const TYPE_PRIVATE_MESSAGE = 'm';
|
||||||
const TYPE_ANY_CONTACT = 'a';
|
const TYPE_ANY_CONTACT = 'a';
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this module.'));
|
throw new HTTPException\UnauthorizedException(L10n::t('You must be logged in to use this module.'));
|
||||||
|
|
|
@ -59,7 +59,7 @@ class UserExport extends BaseSettingsModule
|
||||||
* to the browser which then offers a save / open dialog
|
* to the browser which then offers a save / open dialog
|
||||||
* to the user.
|
* to the user.
|
||||||
**/
|
**/
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$args = self::getClass(Arguments::class);
|
$args = self::getClass(Arguments::class);
|
||||||
if ($args->getArgc() == 3) {
|
if ($args->getArgc() == 3) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Core\System;
|
||||||
*/
|
*/
|
||||||
class Smilies extends BaseModule
|
class Smilies extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -4,29 +4,23 @@ namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
use Friendica\Core\System;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle starred items
|
* Toggle starred items
|
||||||
*/
|
*/
|
||||||
class Starred extends BaseModule
|
class Starred extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
|
||||||
$starred = 0;
|
|
||||||
$itemId = null;
|
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO: Replace with parameter from router
|
if (empty($parameters['item'])) {
|
||||||
if ($a->argc > 1) {
|
exit;
|
||||||
$itemId = intval($a->argv[1]);
|
} else {
|
||||||
}
|
$itemId = intval($parameters['item']);
|
||||||
|
|
||||||
if (!$itemId) {
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]);
|
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]);
|
||||||
|
@ -34,27 +28,18 @@ class Starred extends BaseModule
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!intval($item['starred'])) {
|
$starred = !$item['starred'];
|
||||||
$starred = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Item::update(['starred' => $starred], ['id' => $itemId]);
|
Item::update(['starred' => $starred], ['id' => $itemId]);
|
||||||
|
|
||||||
// See if we've been passed a return path to redirect to
|
// See if we've been passed a return path to redirect to
|
||||||
$returnPath = $_REQUEST['return'] ?? '';
|
$returnPath = $_REQUEST['return'] ?? '';
|
||||||
if ($returnPath) {
|
if (!empty($returnPath)) {
|
||||||
$rand = '_=' . time();
|
$rand = '_=' . time() . (strpos($returnPath, '?') ? '&' : '?') . 'rand';
|
||||||
if (strpos($returnPath, '?')) {
|
self::getApp()->internalRedirect($returnPath . $rand);
|
||||||
$rand = "&$rand";
|
|
||||||
} else {
|
|
||||||
$rand = "?$rand";
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->internalRedirect($returnPath . $rand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// the json doesn't really matter, it will either be 0 or 1
|
// the json doesn't really matter, it will either be 0 or 1
|
||||||
echo json_encode($starred);
|
System::jsonExit($starred);
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Statistics extends BaseModule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$config = self::getApp()->getConfig();
|
$config = self::getApp()->getConfig();
|
||||||
$logger = self::getApp()->getLogger();
|
$logger = self::getApp()->getLogger();
|
||||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Theme extends BaseModule
|
class Theme extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
header("Content-Type: text/css");
|
header("Content-Type: text/css");
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ use Friendica\Core\Theme;
|
||||||
*/
|
*/
|
||||||
class ThemeDetails extends BaseModule
|
class ThemeDetails extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
if (!empty($_REQUEST['theme'])) {
|
if (!empty($_REQUEST['theme'])) {
|
||||||
$theme = $_REQUEST['theme'];
|
$theme = $_REQUEST['theme'];
|
||||||
|
|
|
@ -13,7 +13,7 @@ use Friendica\Util\Crypto;
|
||||||
*/
|
*/
|
||||||
class HostMeta extends BaseModule
|
class HostMeta extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
$config = $app->getConfig();
|
$config = $app->getConfig();
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Model\Search;
|
||||||
*/
|
*/
|
||||||
class XSocialRelay extends BaseModule
|
class XSocialRelay extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
$config = $app->getConfig();
|
$config = $app->getConfig();
|
||||||
|
|
|
@ -17,7 +17,7 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Xrd extends BaseModule
|
class Xrd extends BaseModule
|
||||||
{
|
{
|
||||||
public static function rawContent()
|
public static function rawContent($parameters)
|
||||||
{
|
{
|
||||||
$app = self::getApp();
|
$app = self::getApp();
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1323);
|
define('DB_UPDATE_VERSION', 1324);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -1384,7 +1384,8 @@ return [
|
||||||
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
|
"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"],
|
"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"],
|
"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" => [
|
"indexes" => [
|
||||||
"PRIMARY" => ["uid", "iid"]
|
"PRIMARY" => ["uid", "iid"]
|
||||||
|
|
|
@ -179,8 +179,9 @@ return [
|
||||||
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
|
'/{type}/{customize}/{name}' => [Module\Photo::class, [R::GET]],
|
||||||
],
|
],
|
||||||
|
|
||||||
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
'/pinned/{item:\d+}' => [Module\Pinned::class, [R::GET]],
|
||||||
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
'/pretheme' => [Module\ThemeDetails::class, [R::GET]],
|
||||||
|
'/probe' => [Module\Debug\Probe::class, [R::GET]],
|
||||||
|
|
||||||
'/profile' => [
|
'/profile' => [
|
||||||
'/{nickname}' => [Module\Profile::class, [R::GET]],
|
'/{nickname}' => [Module\Profile::class, [R::GET]],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user