Browse Source

Added parameter to rawContent

pull/7819/head
Michael 2 years ago
parent
commit
abe6724629
36 changed files with 51 additions and 64 deletions
  1. +1
    -1
      src/BaseModule.php
  2. +1
    -1
      src/Module/AccountManagementControlDocument.php
  3. +2
    -2
      src/Module/Admin/PhpInfo.php
  4. +1
    -1
      src/Module/Attach.php
  5. +1
    -1
      src/Module/BaseAdminModule.php
  6. +1
    -1
      src/Module/Contact/Hovercard.php
  7. +1
    -1
      src/Module/Diaspora/Fetch.php
  8. +1
    -1
      src/Module/Filer/SaveTag.php
  9. +1
    -1
      src/Module/Followers.php
  10. +1
    -1
      src/Module/Following.php
  11. +1
    -1
      src/Module/Friendica.php
  12. +1
    -1
      src/Module/Inbox.php
  13. +1
    -1
      src/Module/Item/Ignore.php
  14. +1
    -1
      src/Module/Like.php
  15. +1
    -1
      src/Module/Manifest.php
  16. +1
    -1
      src/Module/NodeInfo.php
  17. +1
    -1
      src/Module/Notifications/Notify.php
  18. +1
    -1
      src/Module/Objects.php
  19. +1
    -1
      src/Module/OpenSearch.php
  20. +1
    -1
      src/Module/Outbox.php
  21. +1
    -1
      src/Module/Profile.php
  22. +1
    -1
      src/Module/PublicRSAKey.php
  23. +1
    -1
      src/Module/ReallySimpleDiscovery.php
  24. +1
    -1
      src/Module/RobotsTxt.php
  25. +1
    -1
      src/Module/Search/Acl.php
  26. +1
    -1
      src/Module/Settings/UserExport.php
  27. +1
    -1
      src/Module/Smilies.php
  28. +11
    -26
      src/Module/Starred.php
  29. +1
    -1
      src/Module/Statistics.php
  30. +1
    -1
      src/Module/Theme.php
  31. +1
    -1
      src/Module/ThemeDetails.php
  32. +1
    -1
      src/Module/WellKnown/HostMeta.php
  33. +1
    -1
      src/Module/WellKnown/XSocialRelay.php
  34. +1
    -1
      src/Module/Xrd.php
  35. +3
    -2
      static/dbstructure.config.php
  36. +3
    -2
      static/routes.config.php

+ 1
- 1
src/BaseModule.php View File

@ -32,7 +32,7 @@ abstract class BaseModule extends BaseObject
* 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;


+ 1
- 1
src/Module/AccountManagementControlDocument.php View File

@ -11,7 +11,7 @@ use Friendica\BaseModule;
*/
class AccountManagementControlDocument extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$output = [
'version' => 1,


+ 2
- 2
src/Module/Admin/PhpInfo.php View File

@ -6,9 +6,9 @@ use Friendica\Module\BaseAdminModule;
class PhpInfo extends BaseAdminModule
{
public static function rawContent()
public static function rawContent($parameters)
{
parent::rawContent();
parent::rawContent($parameters);
phpinfo();
exit();


+ 1
- 1
src/Module/Attach.php View File

@ -20,7 +20,7 @@ class Attach extends BaseModule
/**
* @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) {


+ 1
- 1
src/Module/BaseAdminModule.php View File

@ -35,7 +35,7 @@ abstract class BaseAdminModule extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
if (!is_site_admin()) {
return '';


+ 1
- 1
src/Module/Contact/Hovercard.php View File

@ -18,7 +18,7 @@ use Friendica\Util\Proxy;
*/
class Hovercard extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$contact_url = $_REQUEST['url'] ?? '';


+ 1
- 1
src/Module/Diaspora/Fetch.php View File

@ -17,7 +17,7 @@ use Friendica\Util\Strings;
*/
class Fetch extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 1
- 1
src/Module/Filer/SaveTag.php View File

@ -22,7 +22,7 @@ class SaveTag extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();
$logger = $a->getLogger();


+ 1
- 1
src/Module/Followers.php View File

@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Followers extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/Following.php View File

@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Following extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/Friendica.php View File

@ -88,7 +88,7 @@ class Friendica extends BaseModule
]);
}
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 1
- 1
src/Module/Inbox.php View File

@ -19,7 +19,7 @@ use Friendica\Util\Network;
*/
class Inbox extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/Item/Ignore.php View File

@ -16,7 +16,7 @@ use Friendica\Network\HTTPException;
*/
class Ignore extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
/** @var L10n $l10n */
$l10n = self::getClass(L10n::class);


+ 1
- 1
src/Module/Like.php View File

@ -13,7 +13,7 @@ use Friendica\Util\Strings;
*/
class Like extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
if (!Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException();


+ 1
- 1
src/Module/Manifest.php View File

@ -7,7 +7,7 @@ use Friendica\Core\Renderer;
class Manifest extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();


+ 1
- 1
src/Module/NodeInfo.php View File

@ -22,7 +22,7 @@ class NodeInfo extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 1
- 1
src/Module/Notifications/Notify.php View File

@ -21,7 +21,7 @@ class Notify extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/Objects.php View File

@ -15,7 +15,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Objects extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/OpenSearch.php View File

@ -16,7 +16,7 @@ class OpenSearch extends BaseModule
/**
* @throws \Exception
*/
public static function rawContent()
public static function rawContent($parameters)
{
header('Content-type: application/opensearchdescription+xml');


+ 1
- 1
src/Module/Outbox.php View File

@ -14,7 +14,7 @@ use Friendica\Protocol\ActivityPub;
*/
class Outbox extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$a = self::getApp();


+ 1
- 1
src/Module/Profile.php View File

@ -51,7 +51,7 @@ class Profile extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);


+ 1
- 1
src/Module/PublicRSAKey.php View File

@ -12,7 +12,7 @@ use Friendica\Network\HTTPException\BadRequestException;
*/
class PublicRSAKey extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 1
- 1
src/Module/ReallySimpleDiscovery.php View File

@ -11,7 +11,7 @@ use Friendica\Util\XML;
*/
class ReallySimpleDiscovery extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
header('Content-Type: text/xml');


+ 1
- 1
src/Module/RobotsTxt.php View File

@ -9,7 +9,7 @@ use Friendica\BaseModule;
*/
class RobotsTxt extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$allDisalloweds = [
'/settings/',


+ 1
- 1
src/Module/Search/Acl.php View File

@ -31,7 +31,7 @@ class Acl extends BaseModule
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.'));


+ 1
- 1
src/Module/Settings/UserExport.php View File

@ -59,7 +59,7 @@ class UserExport extends BaseSettingsModule
* 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) {


+ 1
- 1
src/Module/Smilies.php View File

@ -12,7 +12,7 @@ use Friendica\Core\System;
*/
class Smilies extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 11
- 26
src/Module/Starred.php View File

@ -4,29 +4,23 @@ namespace Friendica\Module;
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]);
@ -34,27 +28,18 @@ class Starred extends BaseModule
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);
}
}

+ 1
- 1
src/Module/Statistics.php View File

@ -17,7 +17,7 @@ class Statistics extends BaseModule
}
}
public static function rawContent()
public static function rawContent($parameters)
{
$config = self::getApp()->getConfig();
$logger = self::getApp()->getLogger();


+ 1
- 1
src/Module/Theme.php View File

@ -10,7 +10,7 @@ use Friendica\Util\Strings;
*/
class Theme extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
header("Content-Type: text/css");


+ 1
- 1
src/Module/ThemeDetails.php View File

@ -10,7 +10,7 @@ use Friendica\Core\Theme;
*/
class ThemeDetails extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
if (!empty($_REQUEST['theme'])) {
$theme = $_REQUEST['theme'];


+ 1
- 1
src/Module/WellKnown/HostMeta.php View File

@ -13,7 +13,7 @@ use Friendica\Util\Crypto;
*/
class HostMeta extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();


+ 1
- 1
src/Module/WellKnown/XSocialRelay.php View File

@ -11,7 +11,7 @@ use Friendica\Model\Search;
*/
class XSocialRelay extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();
$config = $app->getConfig();


+ 1
- 1
src/Module/Xrd.php View File

@ -17,7 +17,7 @@ use Friendica\Util\Strings;
*/
class Xrd extends BaseModule
{
public static function rawContent()
public static function rawContent($parameters)
{
$app = self::getApp();


+ 3
- 2
static/dbstructure.config.php View File

@ -34,7 +34,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1323);
define('DB_UPDATE_VERSION', 1324);
}
return [
@ -1384,7 +1384,8 @@ 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"]


+ 3
- 2
static/routes.config.php View File

@ -179,8 +179,9 @@ return [
'/{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]],


Loading…
Cancel
Save