Merge pull request #7819 from annando/pinned

Added parameters to module classes
This commit is contained in:
Hypolite Petovan 2019-11-06 10:28:22 -05:00 committed by GitHub
commit c961128416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 218 additions and 234 deletions

View file

@ -14,7 +14,7 @@ function update_contact_content(App $a)
echo "<section>"; echo "<section>";
if ($_GET["force"] == 1) { if ($_GET["force"] == 1) {
$text = Contact::content(true); $text = Contact::content([], true);
} else { } else {
$text = ''; $text = '';
} }

View file

@ -28,7 +28,7 @@ function update_profile_content(App $a) {
* on the client side and then swap the image back. * on the client side and then swap the image back.
*/ */
$text = Profile::content($profile_uid); $text = Profile::content([], $profile_uid);
if (PConfig::get(local_user(), "system", "bandwidth_saver")) { if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />"; $replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";

View file

@ -308,7 +308,7 @@ class Page implements ArrayAccess
$arr = ['content' => $content]; $arr = ['content' => $content];
Hook::callAll($moduleClass . '_mod_content', $arr); Hook::callAll($moduleClass . '_mod_content', $arr);
$content = $arr['content']; $content = $arr['content'];
$arr = ['content' => call_user_func([$moduleClass, 'content'])]; $arr = ['content' => call_user_func([$moduleClass, 'content'], [])];
Hook::callAll($moduleClass . '_mod_aftercontent', $arr); Hook::callAll($moduleClass . '_mod_aftercontent', $arr);
$content .= $arr['content']; $content .= $arr['content'];
} catch (HTTPException $e) { } catch (HTTPException $e) {

View file

@ -22,7 +22,7 @@ abstract class BaseModule extends BaseObject
* Extend this method if you need to do any shared processing before both * Extend this method if you need to do any shared processing before both
* content() or post() * content() or post()
*/ */
public static function init() public static function init(array $parameters = [])
{ {
} }
@ -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(array $parameters = [])
{ {
// echo ''; // echo '';
// exit; // exit;
@ -47,7 +47,7 @@ abstract class BaseModule extends BaseObject
* *
* @return string * @return string
*/ */
public static function content() public static function content(array $parameters = [])
{ {
$o = ''; $o = '';
@ -60,7 +60,7 @@ abstract class BaseModule extends BaseObject
* Extend this method if the module is supposed to process POST requests. * Extend this method if the module is supposed to process POST requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function post() public static function post(array $parameters = [])
{ {
// $a = self::getApp(); // $a = self::getApp();
// $a->internalRedirect('module'); // $a->internalRedirect('module');
@ -71,9 +71,8 @@ abstract class BaseModule extends BaseObject
* *
* Unknown purpose * Unknown purpose
*/ */
public static function afterpost() public static function afterpost(array $parameters = [])
{ {
} }
/* /*

View file

@ -35,24 +35,24 @@ class LegacyModule extends BaseModule
require_once $file_path; require_once $file_path;
} }
public static function init() public static function init(array $parameters = [])
{ {
self::runModuleFunction('init'); self::runModuleFunction('init', $parameters);
} }
public static function content() public static function content(array $parameters = [])
{ {
return self::runModuleFunction('content'); return self::runModuleFunction('content', $parameters);
} }
public static function post() public static function post(array $parameters = [])
{ {
self::runModuleFunction('post'); self::runModuleFunction('post', $parameters);
} }
public static function afterpost() public static function afterpost(array $parameters = [])
{ {
self::runModuleFunction('afterpost'); self::runModuleFunction('afterpost', $parameters);
} }
/** /**
@ -62,7 +62,7 @@ class LegacyModule extends BaseModule
* @return string * @return string
* @throws \Exception * @throws \Exception
*/ */
private static function runModuleFunction($function_suffix) private static function runModuleFunction($function_suffix, array $parameters = [])
{ {
$function_name = static::$moduleName . '_' . $function_suffix; $function_name = static::$moduleName . '_' . $function_suffix;
@ -70,7 +70,7 @@ class LegacyModule extends BaseModule
$a = self::getApp(); $a = self::getApp();
return $function_name($a); return $function_name($a);
} else { } else {
return parent::{$function_suffix}(); return parent::{$function_suffix}($parameters);
} }
} }
} }

View file

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

View file

@ -11,7 +11,7 @@ use Friendica\Core\System;
*/ */
class Acctlink extends BaseModule class Acctlink extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$addr = trim($_GET['addr'] ?? ''); $addr = trim($_GET['addr'] ?? '');

View file

@ -11,9 +11,9 @@ use Friendica\Util\Strings;
class Details extends BaseAdminModule class Details extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
$a = self::getApp(); $a = self::getApp();
@ -35,9 +35,9 @@ class Details extends BaseAdminModule
$a->internalRedirect('admin/addons'); $a->internalRedirect('admin/addons');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -9,9 +9,9 @@ use Friendica\Module\BaseAdminModule;
class Index extends BaseAdminModule class Index extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -11,9 +11,9 @@ use Friendica\Model;
class Contact extends BaseAdminModule class Contact extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
$contact_url = $_POST['contact_url'] ?? ''; $contact_url = $_POST['contact_url'] ?? '';
$block_reason = $_POST['contact_block_reason'] ?? ''; $block_reason = $_POST['contact_block_reason'] ?? '';
@ -41,9 +41,9 @@ class Contact extends BaseAdminModule
self::getApp()->internalRedirect('admin/blocklist/contact'); self::getApp()->internalRedirect('admin/blocklist/contact');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
class Server extends BaseAdminModule class Server extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
if (empty($_POST['page_blocklist_save']) && empty($_POST['page_blocklist_edit'])) { if (empty($_POST['page_blocklist_save']) && empty($_POST['page_blocklist_edit'])) {
return; return;
@ -50,9 +50,9 @@ class Server extends BaseAdminModule
self::getApp()->internalRedirect('admin/blocklist/server'); self::getApp()->internalRedirect('admin/blocklist/server');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -12,9 +12,9 @@ use Friendica\Module\BaseAdminModule;
class DBSync extends BaseAdminModule class DBSync extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -10,9 +10,9 @@ use Friendica\Module\BaseAdminModule;
class Features extends BaseAdminModule class Features extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features'); parent::checkFormSecurityTokenRedirectOnError('/admin/features', 'admin_manage_features');
@ -42,9 +42,9 @@ class Features extends BaseAdminModule
self::getApp()->internalRedirect('admin/features'); self::getApp()->internalRedirect('admin/features');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$arr = []; $arr = [];
$features = Feature::get(false); $features = Feature::get(false);

View file

@ -10,9 +10,9 @@ use Friendica\Module\BaseAdminModule;
class Federation extends BaseAdminModule class Federation extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing // social and statusnet nodes this node is knowing

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
class Delete extends BaseAdminModule class Delete extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
if (empty($_POST['page_deleteitem_submit'])) { if (empty($_POST['page_deleteitem_submit'])) {
return; return;
@ -36,9 +36,9 @@ class Delete extends BaseAdminModule
self::getApp()->internalRedirect('admin/item/delete'); self::getApp()->internalRedirect('admin/item/delete');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$t = Renderer::getMarkupTemplate('admin/item/delete.tpl'); $t = Renderer::getMarkupTemplate('admin/item/delete.tpl');

View file

@ -13,9 +13,9 @@ use Friendica\Module\BaseAdminModule;
class Source extends BaseAdminModule class Source extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -11,9 +11,9 @@ use Psr\Log\LogLevel;
class Settings extends BaseAdminModule class Settings extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
if (!empty($_POST['page_logs'])) { if (!empty($_POST['page_logs'])) {
parent::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs'); parent::checkFormSecurityTokenRedirectOnError('/admin/logs', 'admin_logs');
@ -37,9 +37,9 @@ class Settings extends BaseAdminModule
self::getApp()->internalRedirect('admin/logs'); self::getApp()->internalRedirect('admin/logs');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
class View extends BaseAdminModule class View extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$t = Renderer::getMarkupTemplate('admin/logs/view.tpl'); $t = Renderer::getMarkupTemplate('admin/logs/view.tpl');
$f = Config::get('system', 'logfile'); $f = Config::get('system', 'logfile');

View file

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

View file

@ -19,9 +19,9 @@ use Friendica\Util\DateTimeFormat;
*/ */
class Queue extends BaseAdminModule class Queue extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -21,9 +21,9 @@ require_once __DIR__ . '/../../../boot.php';
class Site extends BaseAdminModule class Site extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site'); self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
@ -412,9 +412,9 @@ class Site extends BaseAdminModule
$a->internalRedirect('admin/site' . $active_panel); $a->internalRedirect('admin/site' . $active_panel);
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -20,9 +20,9 @@ use Friendica\Util\Network;
class Summary extends BaseAdminModule class Summary extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -11,9 +11,9 @@ use Friendica\Util\Strings;
class Details extends BaseAdminModule class Details extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
$a = self::getApp(); $a = self::getApp();
@ -39,9 +39,9 @@ class Details extends BaseAdminModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -9,7 +9,7 @@ use Friendica\Util\Strings;
class Embed extends BaseAdminModule class Embed extends BaseAdminModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -23,9 +23,9 @@ class Embed extends BaseAdminModule
} }
} }
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
$a = self::getApp(); $a = self::getApp();
@ -53,9 +53,9 @@ class Embed extends BaseAdminModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -11,9 +11,9 @@ use Friendica\Util\Strings;
class Index extends BaseAdminModule class Index extends BaseAdminModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -9,9 +9,9 @@ use Friendica\Module\BaseAdminModule;
class Tos extends BaseAdminModule class Tos extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos'); parent::checkFormSecurityTokenRedirectOnError('/admin/tos', 'admin_tos');
@ -32,9 +32,9 @@ class Tos extends BaseAdminModule
self::getApp()->internalRedirect('admin/tos'); self::getApp()->internalRedirect('admin/tos');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$tos = new \Friendica\Module\Tos(); $tos = new \Friendica\Module\Tos();
$t = Renderer::getMarkupTemplate('admin/tos.tpl'); $t = Renderer::getMarkupTemplate('admin/tos.tpl');

View file

@ -15,9 +15,9 @@ use Friendica\Util\Temporal;
class Users extends BaseAdminModule class Users extends BaseAdminModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
parent::post(); parent::post($parameters);
$a = self::getApp(); $a = self::getApp();
@ -131,9 +131,9 @@ class Users extends BaseAdminModule
$a->internalRedirect('admin/users'); $a->internalRedirect('admin/users');
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
$a = self::getApp(); $a = self::getApp();

View file

@ -16,7 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils;
*/ */
class AllFriends extends BaseModule class AllFriends extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();

View file

@ -13,7 +13,7 @@ use Friendica\Core\Renderer;
*/ */
class Apps extends BaseModule class Apps extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$privateaddons = Config::get('config', 'private_addons'); $privateaddons = Config::get('config', 'private_addons');
if ($privateaddons === "1" && !local_user()) { if ($privateaddons === "1" && !local_user()) {
@ -21,7 +21,7 @@ class Apps extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$apps = Nav::getAppMenu(); $apps = Nav::getAppMenu();

View file

@ -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(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
if ($a->argc != 2) { if ($a->argc != 2) {

View file

@ -23,7 +23,7 @@ require_once 'boot.php';
*/ */
abstract class BaseAdminModule extends BaseModule abstract class BaseAdminModule extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!is_site_admin()) { if (!is_site_admin()) {
return; return;
@ -35,7 +35,7 @@ abstract class BaseAdminModule extends BaseModule
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
if (!is_site_admin()) { if (!is_site_admin()) {
return ''; return '';
@ -48,7 +48,7 @@ abstract class BaseAdminModule extends BaseModule
return ''; return '';
} }
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

@ -9,7 +9,7 @@ use Friendica\Core\Renderer;
class BaseSettingsModule extends BaseModule class BaseSettingsModule extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

@ -14,7 +14,7 @@ use Friendica\Util\Strings;
*/ */
class Bookmarklet extends BaseModule class Bookmarklet extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$_GET['mode'] = 'minimal'; $_GET['mode'] = 'minimal';

View file

@ -75,7 +75,7 @@ class Contact extends BaseModule
$a->internalRedirect('contact'); $a->internalRedirect('contact');
} }
public static function post() public static function post(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -240,7 +240,7 @@ class Contact extends BaseModule
Model\Contact::remove($orig_record['id']); Model\Contact::remove($orig_record['id']);
} }
public static function content($update = 0) public static function content(array $parameters = [], $update = 0)
{ {
if (!local_user()) { if (!local_user()) {
return Login::form($_SERVER['REQUEST_URI']); return Login::form($_SERVER['REQUEST_URI']);

View file

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

View file

@ -13,7 +13,7 @@ use Friendica\Core\Renderer;
*/ */
class Credits extends BaseModule class Credits extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
/* fill the page with credits */ /* fill the page with credits */
$credits_string = file_get_contents('CREDITS.txt'); $credits_string = file_get_contents('CREDITS.txt');

View file

@ -14,7 +14,7 @@ use Friendica\Util\XML;
*/ */
class Babel extends BaseModule class Babel extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
function visible_whitespace($s) function visible_whitespace($s)
{ {

View file

@ -14,7 +14,7 @@ use Friendica\Util\Network;
*/ */
class Feed extends BaseModule class Feed extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
info(L10n::t('You must be logged in to use this module')); info(L10n::t('You must be logged in to use this module'));
@ -22,7 +22,7 @@ class Feed extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$result = []; $result = [];
if (!empty($_REQUEST['url'])) { if (!empty($_REQUEST['url'])) {

View file

@ -12,7 +12,7 @@ use Friendica\Network\HTTPException;
*/ */
class ItemBody extends BaseModule class ItemBody extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(L10n::t('Access denied.')); throw new HTTPException\UnauthorizedException(L10n::t('Access denied.'));

View file

@ -10,7 +10,7 @@ use Friendica\Util\Temporal;
class Localtime extends BaseModule class Localtime extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
$time = ($_REQUEST['time'] ?? '') ?: 'now'; $time = ($_REQUEST['time'] ?? '') ?: 'now';
@ -21,7 +21,7 @@ class Localtime extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();

View file

@ -13,7 +13,7 @@ use Friendica\Network\Probe as NetworkProbe;
*/ */
class Probe extends BaseModule class Probe extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
$e = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.')); $e = new HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));

View file

@ -12,7 +12,7 @@ use Friendica\Network\Probe;
*/ */
class WebFinger extends BaseModule class WebFinger extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
$e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.')); $e = new \Friendica\Network\HTTPException\ForbiddenException(L10n::t('Only logged in users are permitted to perform a probing.'));

View file

@ -17,7 +17,7 @@ use Friendica\Network\HTTPException\ForbiddenException;
*/ */
class Delegation extends BaseModule class Delegation extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -92,7 +92,7 @@ class Delegation extends BaseModule
// NOTREACHED // NOTREACHED
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new ForbiddenException(L10n::t('Permission denied.')); throw new ForbiddenException(L10n::t('Permission denied.'));

View file

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

View file

@ -21,13 +21,13 @@ class Receive extends BaseModule
/** @var LoggerInterface */ /** @var LoggerInterface */
private static $logger; private static $logger;
public static function init() public static function init(array $parameters = [])
{ {
/** @var LoggerInterface $logger */ /** @var LoggerInterface $logger */
self::$logger = self::getClass(LoggerInterface::class); self::$logger = self::getClass(LoggerInterface::class);
} }
public static function post() public static function post(array $parameters = [])
{ {
/** @var Configuration $config */ /** @var Configuration $config */
$config = self::getClass(Configuration::class); $config = self::getClass(Configuration::class);

View file

@ -21,7 +21,7 @@ use Friendica\Util\Strings;
*/ */
class Directory extends BaseModule class Directory extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();
$config = $app->getConfig(); $config = $app->getConfig();

View file

@ -23,7 +23,7 @@ use Friendica\Protocol\OStatus;
*/ */
class Feed extends BaseModule class Feed extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

@ -12,7 +12,7 @@ use Friendica\Util\XML;
*/ */
class RemoveTag extends BaseModule class RemoveTag extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();

View file

@ -14,7 +14,7 @@ use Friendica\Util\XML;
*/ */
class SaveTag extends BaseModule class SaveTag extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
info(L10n::t('You must be logged in to use this module')); info(L10n::t('You must be logged in to use this module'));
@ -22,7 +22,7 @@ class SaveTag extends BaseModule
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
$logger = $a->getLogger(); $logger = $a->getLogger();

View file

@ -18,7 +18,7 @@ use Friendica\Util\DateTimeFormat;
*/ */
class FollowConfirm extends BaseModule class FollowConfirm extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

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

View file

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

View file

@ -15,7 +15,7 @@ use Friendica\Model\User;
*/ */
class Friendica extends BaseModule class Friendica extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();
$config = $app->getConfig(); $config = $app->getConfig();
@ -88,7 +88,7 @@ class Friendica extends BaseModule
]); ]);
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();

View file

@ -19,7 +19,7 @@ require_once 'boot.php';
class Group extends BaseModule class Group extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -132,7 +132,7 @@ class Group extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$change = false; $change = false;

View file

@ -8,7 +8,7 @@ use Friendica\Network\HTTPException;
class MethodNotAllowed extends BaseModule class MethodNotAllowed extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
throw new HTTPException\MethodNotAllowedException(L10n::t('Method Not Allowed.')); throw new HTTPException\MethodNotAllowedException(L10n::t('Method Not Allowed.'));
} }

View file

@ -8,7 +8,7 @@ use Friendica\Network\HTTPException;
class PageNotFound extends BaseModule class PageNotFound extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
throw new HTTPException\NotFoundException(L10n::t('Page not found.')); throw new HTTPException\NotFoundException(L10n::t('Page not found.'));
} }

View file

@ -15,7 +15,7 @@ use Friendica\Util\Strings;
class Hashtag extends BaseModule class Hashtag extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$result = []; $result = [];

View file

@ -14,7 +14,7 @@ use Friendica\Util\Strings;
*/ */
class Help extends BaseModule class Help extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
Nav::setSelected('help'); Nav::setSelected('help');

View file

@ -12,7 +12,7 @@ use Friendica\Core\Renderer;
*/ */
class Home extends BaseModule class Home extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();
$config = $app->getConfig(); $config = $app->getConfig();

View file

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

View file

@ -46,7 +46,7 @@ class Install extends BaseModule
*/ */
private static $installer; private static $installer;
public static function init() public static function init(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -76,7 +76,7 @@ class Install extends BaseModule
self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK; self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
} }
public static function post() public static function post(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
$configCache = $a->getConfigCache(); $configCache = $a->getConfigCache();
@ -149,7 +149,7 @@ class Install extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
$configCache = $a->getConfigCache(); $configCache = $a->getConfigCache();

View file

@ -16,7 +16,7 @@ use Friendica\Util\Strings;
*/ */
class Invite extends BaseModule class Invite extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
@ -104,7 +104,7 @@ class Invite extends BaseModule
notice(L10n::tt('%d message sent.', '%d messages sent.', $total) . EOL); notice(L10n::tt('%d message sent.', '%d messages sent.', $total) . EOL);
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));

View file

@ -21,7 +21,7 @@ use Friendica\Util\Crypto;
class Compose extends BaseModule class Compose extends BaseModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!empty($_REQUEST['body'])) { if (!empty($_REQUEST['body'])) {
$_REQUEST['return'] = 'network'; $_REQUEST['return'] = 'network';
@ -32,7 +32,7 @@ class Compose extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('compose', false); return Login::form('compose', false);

View file

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

View file

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

View file

@ -30,7 +30,7 @@ use LightOpenID;
*/ */
class Login extends BaseModule class Login extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -41,7 +41,7 @@ class Login extends BaseModule
return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED); return self::form(Session::get('return_path'), intval(Config::get('config', 'register_policy')) !== \Friendica\Module\Register::CLOSED);
} }
public static function post() public static function post(array $parameters = [])
{ {
$openid_identity = Session::get('openid_identity'); $openid_identity = Session::get('openid_identity');
$openid_server = Session::get('openid_server'); $openid_server = Session::get('openid_server');

View file

@ -23,7 +23,7 @@ class Logout extends BaseModule
/** /**
* @brief Process logout requests * @brief Process logout requests
*/ */
public static function init() public static function init(array $parameters = [])
{ {
$visitor_home = null; $visitor_home = null;
if (remote_user()) { if (remote_user()) {

View file

@ -20,7 +20,7 @@ use Friendica\Util\Strings;
*/ */
class Magic extends BaseModule class Magic extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
$ret = ['success' => false, 'url' => '', 'message' => '']; $ret = ['success' => false, 'url' => '', 'message' => ''];

View file

@ -14,7 +14,7 @@ use Friendica\Util\Strings;
*/ */
class Maintenance extends BaseModule class Maintenance extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$config = self::getApp()->getConfig(); $config = self::getApp()->getConfig();

View file

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

View file

@ -13,7 +13,7 @@ use Friendica\Core\System;
*/ */
class NodeInfo extends BaseModule class NodeInfo extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$config = self::getApp()->getConfig(); $config = self::getApp()->getConfig();
@ -22,7 +22,7 @@ class NodeInfo extends BaseModule
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();

View file

@ -14,14 +14,14 @@ use Friendica\Network\HTTPException;
*/ */
class Notify extends BaseModule class Notify extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
throw new HTTPException\UnauthorizedException(L10n::t('Permission denied.')); throw new HTTPException\UnauthorizedException(L10n::t('Permission denied.'));
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -45,7 +45,7 @@ class Notify extends BaseModule
* @return string|void * @return string|void
* @throws HTTPException\InternalServerErrorException * @throws HTTPException\InternalServerErrorException
*/ */
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

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

View file

@ -17,7 +17,7 @@ use Friendica\Util\Strings;
*/ */
class Oembed extends BaseModule class Oembed extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

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

View file

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

View file

@ -27,7 +27,7 @@ use Friendica\Util\Strings;
*/ */
class Owa extends BaseModule class Owa extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$ret = [ 'success' => false ]; $ret = [ 'success' => false ];

View file

@ -23,7 +23,7 @@ class Photo extends BaseModule
* Fetch a photo or an avatar, in optional size, check for permissions and * Fetch a photo or an avatar, in optional size, check for permissions and
* return the image * return the image
*/ */
public static function init() public static function init(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router

View file

@ -33,7 +33,7 @@ class Profile extends BaseModule
public static $which = ''; public static $which = '';
public static $profile = 0; public static $profile = 0;
public static function init() public static function init(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();
@ -51,7 +51,7 @@ class Profile extends BaseModule
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
if (ActivityPub::isRequest()) { if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]); $user = DBA::selectFirst('user', ['uid'], ['nickname' => self::$which]);
@ -75,7 +75,7 @@ class Profile extends BaseModule
} }
} }
public static function content($update = 0) public static function content(array $parameters = [], $update = 0)
{ {
$a = self::getApp(); $a = self::getApp();

View file

@ -18,7 +18,7 @@ use Friendica\Util\Proxy as ProxyUtils;
class Contacts extends BaseModule class Contacts extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) { if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.')); throw new \Friendica\Network\HTTPException\NotFoundException(L10n::t('User not found.'));

View file

@ -30,7 +30,7 @@ class Proxy extends BaseModule
* Sets application instance and checks if /proxy/ path is writable. * Sets application instance and checks if /proxy/ path is writable.
* *
*/ */
public static function init() public static function init(array $parameters = [])
{ {
// Set application instance here // Set application instance here
$a = self::getApp(); $a = self::getApp();

View file

@ -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(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();

View file

@ -11,7 +11,7 @@ use Friendica\Model\GContact;
*/ */
class RandomProfile extends BaseModule class RandomProfile extends BaseModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$a = self::getApp(); $a = self::getApp();

View file

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

View file

@ -35,7 +35,7 @@ class Register extends BaseModule
* *
* @return string * @return string
*/ */
public static function content() public static function content(array $parameters = [])
{ {
// logged in users can register others (people/pages/groups) // logged in users can register others (people/pages/groups)
// even with closed registrations, unless specifically prohibited by site policy. // even with closed registrations, unless specifically prohibited by site policy.
@ -152,7 +152,7 @@ class Register extends BaseModule
* Extend this method if the module is supposed to process POST requests. * Extend this method if the module is supposed to process POST requests.
* Doesn't display any content * Doesn't display any content
*/ */
public static function post() public static function post(array $parameters = [])
{ {
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register'); BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');

View file

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

View file

@ -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(array $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.'));

View file

@ -13,7 +13,7 @@ use Friendica\Util\Strings;
*/ */
class Directory extends BaseSearchModule class Directory extends BaseSearchModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
notice(L10n::t('Permission denied.')); notice(L10n::t('Permission denied.'));

View file

@ -23,7 +23,7 @@ use Friendica\Util\Strings;
class Index extends BaseSearchModule class Index extends BaseSearchModule
{ {
public static function content() public static function content(array $parameters = [])
{ {
$search = (!empty($_GET['q']) ? Strings::escapeTags(trim(rawurldecode($_GET['q']))) : ''); $search = (!empty($_GET['q']) ? Strings::escapeTags(trim(rawurldecode($_GET['q']))) : '');

View file

@ -10,7 +10,7 @@ use Friendica\Util\Strings;
class Saved extends BaseModule class Saved extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
/** @var Arguments $args */ /** @var Arguments $args */
$args = self::getClass(Arguments::class); $args = self::getClass(Arguments::class);

View file

@ -20,7 +20,7 @@ use Friendica\Util\Strings;
*/ */
class Delegation extends BaseSettingsModule class Delegation extends BaseSettingsModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user() || !empty(self::getApp()->user['uid']) && self::getApp()->user['uid'] != local_user()) { if (!local_user() || !empty(self::getApp()->user['uid']) && self::getApp()->user['uid'] != local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
@ -46,9 +46,9 @@ class Delegation extends BaseSettingsModule
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]); DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
} }
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
if (!local_user()) { if (!local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.')); throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));

View file

@ -20,7 +20,7 @@ class AppSpecific extends BaseSettingsModule
{ {
private static $appSpecificPassword = null; private static $appSpecificPassword = null;
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -38,7 +38,7 @@ class AppSpecific extends BaseSettingsModule
} }
} }
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -81,13 +81,13 @@ class AppSpecific extends BaseSettingsModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('settings/2fa/app_specific'); return Login::form('settings/2fa/app_specific');
} }
parent::content(); parent::content($parameters);
$appSpecificPasswords = AppSpecificPassword::getListForUser(local_user()); $appSpecificPasswords = AppSpecificPassword::getListForUser(local_user());

View file

@ -17,7 +17,7 @@ use PragmaRX\Google2FA\Google2FA;
class Index extends BaseSettingsModule class Index extends BaseSettingsModule
{ {
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -73,13 +73,13 @@ class Index extends BaseSettingsModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('settings/2fa'); return Login::form('settings/2fa');
} }
parent::content(); parent::content($parameters);
$has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret'); $has_secret = (bool) PConfig::get(local_user(), '2fa', 'secret');
$verified = PConfig::get(local_user(), '2fa', 'verified'); $verified = PConfig::get(local_user(), '2fa', 'verified');

View file

@ -18,7 +18,7 @@ use Friendica\Module\Login;
*/ */
class Recovery extends BaseSettingsModule class Recovery extends BaseSettingsModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -36,7 +36,7 @@ class Recovery extends BaseSettingsModule
} }
} }
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -53,13 +53,13 @@ class Recovery extends BaseSettingsModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('settings/2fa/recovery'); return Login::form('settings/2fa/recovery');
} }
parent::content(); parent::content($parameters);
if (!RecoveryCode::countValidForUser(local_user())) { if (!RecoveryCode::countValidForUser(local_user())) {
RecoveryCode::generateForUser(local_user()); RecoveryCode::generateForUser(local_user());

View file

@ -24,7 +24,7 @@ use PragmaRX\Google2FA\Google2FA;
*/ */
class Verify extends BaseSettingsModule class Verify extends BaseSettingsModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -43,7 +43,7 @@ class Verify extends BaseSettingsModule
} }
} }
public static function post() public static function post(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return; return;
@ -69,13 +69,13 @@ class Verify extends BaseSettingsModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
if (!local_user()) { if (!local_user()) {
return Login::form('settings/2fa/verify'); return Login::form('settings/2fa/verify');
} }
parent::content(); parent::content($parameters);
$company = 'Friendica'; $company = 'Friendica';
$holder = Session::get('my_address'); $holder = Session::get('my_address');

View file

@ -32,9 +32,9 @@ class UserExport extends BaseSettingsModule
* If there is an action required through the URL / path, react * If there is an action required through the URL / path, react
* accordingly and export the requested data. * accordingly and export the requested data.
**/ **/
public static function content() public static function content(array $parameters = [])
{ {
parent::content(); parent::content($parameters);
/** /**
* options shown on "Export personal data" page * options shown on "Export personal data" page
@ -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(array $parameters = [])
{ {
$args = self::getClass(Arguments::class); $args = self::getClass(Arguments::class);
if ($args->getArgc() == 3) { if ($args->getArgc() == 3) {

View file

@ -12,7 +12,7 @@ use Friendica\Core\System;
*/ */
class Smilies extends BaseModule class Smilies extends BaseModule
{ {
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$app = self::getApp(); $app = self::getApp();
@ -26,7 +26,7 @@ class Smilies extends BaseModule
} }
} }
public static function content() public static function content(array $parameters = [])
{ {
$smilies = Content\Smilies::getList(); $smilies = Content\Smilies::getList();
$count = count($smilies['texts'] ?? []); $count = count($smilies['texts'] ?? []);

View file

@ -10,51 +10,36 @@ use Friendica\Model\Item;
*/ */
class Starred extends BaseModule class Starred extends BaseModule
{ {
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$a = self::getApp();
$starred = 0;
$itemId = null;
if (!local_user()) { if (!local_user()) {
exit(); throw new \Friendica\Network\HTTPException\ForbiddenException();
} }
// @TODO: Replace with parameter from router if (empty($parameters['item'])) {
if ($a->argc > 1) { throw new \Friendica\Network\HTTPException\BadRequestException();
$itemId = intval($a->argv[1]);
} }
if (!$itemId) { $itemId = intval($parameters['item']);
exit();
}
$item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]); $item = Item::selectFirstForUser(local_user(), ['starred'], ['uid' => local_user(), 'id' => $itemId]);
if (empty($item)) { if (empty($item)) {
exit(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
if (!intval($item['starred'])) { $starred = !(bool)$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); echo json_encode((int)$starred);
exit(); exit();
} }
} }

View file

@ -8,7 +8,7 @@ use Friendica\Core\System;
class Statistics extends BaseModule class Statistics extends BaseModule
{ {
public static function init() public static function init(array $parameters = [])
{ {
$config = self::getApp()->getConfig(); $config = self::getApp()->getConfig();
@ -17,7 +17,7 @@ class Statistics extends BaseModule
} }
} }
public static function rawContent() public static function rawContent(array $parameters = [])
{ {
$config = self::getApp()->getConfig(); $config = self::getApp()->getConfig();
$logger = self::getApp()->getLogger(); $logger = self::getApp()->getLogger();

View file

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

Some files were not shown because too many files have changed in this diff Show more