Merge pull request #1 from friendica/develop

Update from friendica/friendica
This commit is contained in:
Casper 2019-11-14 22:36:36 +00:00 committed by GitHub
commit 91ba4bb2ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 4831 additions and 4393 deletions

View file

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2019.09-rc (Dalmatian Bellflower)
-- DB_UPDATE_VERSION 1322
-- Friendica 2019.12-dev (Dalmatian Bellflower)
-- DB_UPDATE_VERSION 1324
-- ------------------------------------------
@ -793,7 +793,6 @@ CREATE TABLE IF NOT EXISTS `manage` (
--
CREATE TABLE IF NOT EXISTS `notify` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`hash` varchar(64) NOT NULL DEFAULT '' COMMENT '',
`type` smallint unsigned NOT NULL DEFAULT 0 COMMENT '',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
@ -810,7 +809,6 @@ CREATE TABLE IF NOT EXISTS `notify` (
`name_cache` tinytext COMMENT 'Cached bbcode parsing of name',
`msg_cache` mediumtext COMMENT 'Cached bbcode parsing of msg',
PRIMARY KEY(`id`),
INDEX `hash_uid` (`hash`,`uid`),
INDEX `seen_uid_date` (`seen`,`uid`,`date`),
INDEX `uid_date` (`uid`,`date`),
INDEX `uid_type_link` (`uid`,`type`,`link`(190))
@ -1281,7 +1279,9 @@ CREATE TABLE IF NOT EXISTS `user-item` (
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Marker to hide an item from the user',
`ignored` boolean COMMENT 'Ignore this thread if set',
PRIMARY KEY(`uid`,`iid`)
`pinned` boolean COMMENT 'The item is pinned on the profile page',
PRIMARY KEY(`uid`,`iid`),
INDEX `uid_pinned` (`uid`,`pinned`)
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='User specific item data';
--

View file

@ -2554,6 +2554,7 @@ function api_get_attachments(&$body)
{
$text = $body;
$text = preg_replace("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism", '[img]$3[/img]', $text);
$text = preg_replace("/\[img\=(.*?)\](.*?)\[\/img\]/ism", '[img]$1[/img]', $text);
$URLSearchString = "^\[\]";
$ret = preg_match_all("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $text, $images);

View file

@ -801,10 +801,12 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
/**
* Fetch all comments from a query. Additionally set the newest resharer as thread owner.
*
* @param $thread_items Database statement with thread posts
* @param array $thread_items Database statement with thread posts
* @param boolean $pinned Is the item pinned?
*
* @return array items with parents and comments
*/
function conversation_fetch_comments($thread_items) {
function conversation_fetch_comments($thread_items, $pinned) {
$comments = [];
$parentlines = [];
$lineno = 0;
@ -822,6 +824,10 @@ function conversation_fetch_comments($thread_items) {
$parentlines[] = $lineno;
}
if ($row['gravity'] == GRAVITY_PARENT) {
$row['pinned'] = $pinned;
}
$comments[] = $row;
$lineno++;
}
@ -872,7 +878,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
$thread_items = Item::selectForUser(local_user(), array_merge(Item::DISPLAY_FIELDLIST, ['contact-uid', 'gravity']), $condition, $params);
$comments = conversation_fetch_comments($thread_items);
$comments = conversation_fetch_comments($thread_items, $parent['pinned'] ?? false);
if (count($comments) != 0) {
$items = array_merge($items, $comments);
@ -1451,7 +1457,9 @@ function conv_sort(array $item_list, $order)
}
}
if (stristr($order, 'received')) {
if (stristr($order, 'pinned_received')) {
usort($parents, 'sort_thr_pinned_received');
} elseif (stristr($order, 'received')) {
usort($parents, 'sort_thr_received');
} elseif (stristr($order, 'commented')) {
usort($parents, 'sort_thr_commented');
@ -1488,6 +1496,24 @@ function conv_sort(array $item_list, $order)
return $parents;
}
/**
* @brief usort() callback to sort item arrays by pinned and the received key
*
* @param array $a
* @param array $b
* @return int
*/
function sort_thr_pinned_received(array $a, array $b)
{
if ($b['pinned'] && !$a['pinned']) {
return 1;
} elseif (!$b['pinned'] && $a['pinned']) {
return -1;
}
return strcmp($b['received'], $a['received']);
}
/**
* @brief usort() callback to sort item arrays by the received key
*

View file

@ -503,17 +503,9 @@ function notification($params)
if ($show_in_notification_page) {
Logger::log("adding notification entry", Logger::DEBUG);
do {
$dups = false;
$hash = Strings::getRandomHex();
if (DBA::exists('notify', ['hash' => $hash])) {
$dups = true;
}
} while ($dups == true);
/// @TODO One statement is enough
$datarray = [];
$datarray['hash'] = $hash;
$datarray['name'] = $params['source_name'];
$datarray['name_cache'] = strip_tags(BBCode::convert($params['source_name']));
$datarray['url'] = $params['source_link'];
@ -536,7 +528,7 @@ function notification($params)
}
// create notification entry in DB
$fields = ['hash' => $datarray['hash'], 'name' => $datarray['name'], 'url' => $datarray['url'],
$fields = ['name' => $datarray['name'], 'url' => $datarray['url'],
'photo' => $datarray['photo'], 'date' => $datarray['date'], 'uid' => $datarray['uid'],
'link' => $datarray['link'], 'iid' => $datarray['iid'], 'parent' => $datarray['parent'],
'type' => $datarray['type'], 'verb' => $datarray['verb'], 'otype' => $datarray['otype'],
@ -545,26 +537,6 @@ function notification($params)
$notify_id = DBA::lastInsertId();
// we seem to have a lot of duplicate comment notifications due to race conditions, mostly from forums
// After we've stored everything, look again to see if there are any duplicates and if so remove them
$p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`",
intval(NOTIFY_TAGSELF),
intval(NOTIFY_COMMENT),
DBA::escape($params['link']),
intval($params['uid'])
);
if ($p && (count($p) > 1)) {
for ($d = 1; $d < count($p); $d ++) {
DBA::delete('notify', ['id' => $p[$d]['id']]);
}
// only continue on if we stored the first one
if ($notify_id != $p[0]['id']) {
L10n::popLang();
return false;
}
}
$itemlink = System::baseUrl().'/notify/view/'.$notify_id;
$msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]);
$msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg)));

View file

@ -596,9 +596,9 @@ function settings_post(App $a)
$fields = ['username' => $username, 'email' => $email, 'timezone' => $timezone,
'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow, 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,
'notify-flags' => $notify, 'page-flags' => $notify, 'account-type' => $account_type, 'default-location' => $defloc,
'notify-flags' => $notify, 'page-flags' => $page_flags, 'account-type' => $account_type, 'default-location' => $defloc,
'allow_location' => $allow_location, 'maxreq' => $maxreq, 'expire' => $expire, 'def_gid' => $def_gid, 'blockwall' => $blockwall,
'hidewall' => $hide_wall, 'blocktags' => $blocktags, 'unkmail' => $unkmail, 'cntunkmail' => $cntunkmail, 'language' => $language];
'hidewall' => $hidewall, 'blocktags' => $blocktags, 'unkmail' => $unkmail, 'cntunkmail' => $cntunkmail, 'language' => $language];
if ($delete_openid) {
$fields['openid'] = '';
@ -1253,7 +1253,7 @@ function settings_content(App $a)
'$importcontact' => L10n::t('Import Contacts'),
'$importcontact_text' => L10n::t('Upload a CSV file that contains the handle of your followed accounts in the first column you exported from the old account.'),
'$importcontact_button' => L10n::t('Upload File'),
'$importcontact_maxsize' => Config::get('system', max_csv_file_size, 30720),
'$importcontact_maxsize' => Config::get('system', 'max_csv_file_size', 30720),
'$relocate' => L10n::t('Relocate'),
'$relocate_text' => L10n::t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."),
'$relocate_button' => L10n::t("Resend relocate message to contacts"),

View file

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

View file

@ -28,7 +28,7 @@ function update_profile_content(App $a) {
* 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")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";

View file

@ -63,6 +63,11 @@ class Module
*/
private $module_class;
/**
* @var array The module parameters
*/
private $module_parameters;
/**
* @var bool true, if the module is a backend module
*/
@ -89,6 +94,14 @@ class Module
return $this->module_class;
}
/**
* @return array The module parameters extracted from the route
*/
public function getParameters()
{
return $this->module_parameters;
}
/**
* @return bool True, if the current module is a backend module
* @see Module::BACKEND_MODULES for a list
@ -98,10 +111,11 @@ class Module
return $this->isBackend;
}
public function __construct(string $module = self::DEFAULT, string $moduleClass = self::DEFAULT_CLASS, bool $isBackend = false, bool $printNotAllowedAddon = false)
public function __construct(string $module = self::DEFAULT, string $moduleClass = self::DEFAULT_CLASS, array $moduleParameters = [], bool $isBackend = false, bool $printNotAllowedAddon = false)
{
$this->module = $module;
$this->module_class = $moduleClass;
$this->module_parameters = $moduleParameters;
$this->isBackend = $isBackend;
$this->printNotAllowedAddon = $printNotAllowedAddon;
}
@ -129,7 +143,7 @@ class Module
$isBackend = in_array($module, Module::BACKEND_MODULES);;
return new Module($module, $this->module_class, $isBackend, $this->printNotAllowedAddon);
return new Module($module, $this->module_class, [], $isBackend, $this->printNotAllowedAddon);
}
/**
@ -148,6 +162,7 @@ class Module
$printNotAllowedAddon = false;
$module_class = null;
$module_parameters = [];
/**
* ROUTING
*
@ -156,6 +171,7 @@ class Module
**/
try {
$module_class = $router->getModuleClass($args->getCommand());
$module_parameters = $router->getModuleParameters();
} catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class;
} catch (NotFoundException $e) {
@ -185,7 +201,7 @@ class Module
$module_class = $module_class ?: PageNotFound::class;
}
return new Module($this->module, $module_class, $this->isBackend, $printNotAllowedAddon);
return new Module($this->module, $module_class, $module_parameters, $this->isBackend, $printNotAllowedAddon);
}
/**
@ -233,18 +249,18 @@ class Module
Core\Hook::callAll($this->module . '_mod_init', $placeholder);
call_user_func([$this->module_class, 'init']);
call_user_func([$this->module_class, 'init'], $this->module_parameters);
// "rawContent" is especially meant for technical endpoints.
// This endpoint doesn't need any theme initialization or other comparable stuff.
call_user_func([$this->module_class, 'rawContent']);
call_user_func([$this->module_class, 'rawContent'], $this->module_parameters);
if ($server['REQUEST_METHOD'] === 'POST') {
Core\Hook::callAll($this->module . '_mod_post', $post);
call_user_func([$this->module_class, 'post']);
call_user_func([$this->module_class, 'post'], $this->module_parameters);
}
Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder);
call_user_func([$this->module_class, 'afterpost']);
call_user_func([$this->module_class, 'afterpost'], $this->module_parameters);
}
}

View file

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

View file

@ -39,6 +39,11 @@ class Router
*/
private $httpMethod;
/**
* @var array Module parameters
*/
private $parameters = [];
/**
* @param array $server The $_SERVER variable
* @param RouteCollector|null $routeCollector Optional the loaded Route collector
@ -60,12 +65,21 @@ class Router
*
* @throws HTTPException\InternalServerErrorException In case of invalid configs
*/
public function addRoutes(array $routes)
public function loadRoutes(array $routes)
{
$routeCollector = (isset($this->routeCollector) ?
$this->routeCollector :
new RouteCollector(new Std(), new GroupCountBased()));
$this->addRoutes($routeCollector, $routes);
$this->routeCollector = $routeCollector;
return $this;
}
private function addRoutes(RouteCollector $routeCollector, array $routes)
{
foreach ($routes as $route => $config) {
if ($this->isGroup($config)) {
$this->addGroup($route, $config, $routeCollector);
@ -75,10 +89,6 @@ class Router
throw new HTTPException\InternalServerErrorException("Wrong route config for route '" . print_r($route, true) . "'");
}
}
$this->routeCollector = $routeCollector;
return $this;
}
/**
@ -91,15 +101,7 @@ class Router
private function addGroup(string $groupRoute, array $routes, RouteCollector $routeCollector)
{
$routeCollector->addGroup($groupRoute, function (RouteCollector $routeCollector) use ($routes) {
foreach ($routes as $route => $config) {
if ($this->isGroup($config)) {
$this->addGroup($route, $config, $routeCollector);
} elseif ($this->isRoute($config)) {
$routeCollector->addRoute($config[1], $route, $config[0]);
}else {
throw new HTTPException\InternalServerErrorException("Wrong route config for route '" . print_r($route, true) . "'");
}
}
$this->addRoutes($routeCollector, $routes);
});
}
@ -169,13 +171,15 @@ class Router
$cmd = '/' . ltrim($cmd, '/');
$dispatcher = new \FastRoute\Dispatcher\GroupCountBased($this->routeCollector->getData());
$dispatcher = new Dispatcher\GroupCountBased($this->routeCollector->getData());
$moduleClass = null;
$this->parameters = [];
$routeInfo = $dispatcher->dispatch($this->httpMethod, $cmd);
if ($routeInfo[0] === Dispatcher::FOUND) {
$moduleClass = $routeInfo[1];
$this->parameters = $routeInfo[2];
} elseif ($routeInfo[0] === Dispatcher::METHOD_NOT_ALLOWED) {
throw new HTTPException\MethodNotAllowedException(L10n::t('Method not allowed for this module. Allowed method(s): %s', implode(', ', $routeInfo[1])));
} else {
@ -184,4 +188,14 @@ class Router
return $moduleClass;
}
/**
* Returns the module parameters.
*
* @return array parameters
*/
public function getModuleParameters()
{
return $this->parameters;
}
}

View file

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

View file

@ -1680,7 +1680,7 @@ class BBCode extends BaseObject
$text = str_replace(["\r","\n"], ['<br />', '<br />'], $text);
// Remove all hashtag addresses
if ((!$try_oembed || $simple_html) && !in_array($simple_html, [3, 7, 9])) {
if ($simple_html && !in_array($simple_html, [3, 7, 9])) {
$text = preg_replace("/([#@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $text);
} elseif ($simple_html == 3) {
// The ! is converted to @ since Diaspora only understands the @

View file

@ -35,24 +35,24 @@ class LegacyModule extends BaseModule
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
* @throws \Exception
*/
private static function runModuleFunction($function_suffix)
private static function runModuleFunction($function_suffix, array $parameters = [])
{
$function_name = static::$moduleName . '_' . $function_suffix;
@ -70,7 +70,7 @@ class LegacyModule extends BaseModule
$a = self::getApp();
return $function_name($a);
} else {
return parent::{$function_suffix}();
return parent::{$function_suffix}($parameters);
}
}
}

View file

@ -58,7 +58,7 @@ class Item extends BaseObject
'author-id', 'author-link', 'author-name', 'author-avatar', 'author-network',
'owner-id', 'owner-link', 'owner-name', 'owner-avatar', 'owner-network',
'contact-id', 'contact-uid', 'contact-link', 'contact-name', 'contact-avatar',
'writable', 'self', 'cid', 'alias',
'writable', 'self', 'cid', 'alias', 'pinned',
'event-id', 'event-created', 'event-edited', 'event-start', 'event-finish',
'event-summary', 'event-desc', 'event-location', 'event-type',
'event-nofinish', 'event-adjust', 'event-ignore', 'event-id',
@ -114,6 +114,80 @@ class Item extends BaseObject
return self::$legacy_mode;
}
/**
* Set the pinned state of an item
*
* @param integer $iid Item ID
* @param integer $uid User ID
* @param boolean $pinned Pinned state
*/
public static function setPinned(int $iid, int $uid, bool $pinned)
{
DBA::update('user-item', ['pinned' => $pinned], ['iid' => $iid, 'uid' => $uid], true);
}
/**
* Get the pinned state
*
* @param integer $iid Item ID
* @param integer $uid User ID
*
* @return boolean pinned state
*/
public static function getPinned(int $iid, int $uid)
{
$useritem = DBA::selectFirst('user-item', ['pinned'], ['iid' => $iid, 'uid' => $uid]);
if (!DBA::isResult($useritem)) {
return false;
}
return (bool)$useritem['pinned'];
}
/**
* @brief Select pinned rows from the item table for a given user
*
* @param integer $uid User ID
* @param array $selected Array of selected fields, empty for all
* @param array $condition Array of fields for condition
* @param array $params Array of several parameters
*
* @return boolean|object
* @throws \Exception
*/
public static function selectPinned(int $uid, array $selected = [], array $condition = [], $params = [])
{
$useritems = DBA::select('user-item', ['iid'], ['uid' => $uid, 'pinned' => true]);
if (!DBA::isResult($useritems)) {
return $useritems;
}
$pinned = [];
while ($useritem = self::fetch($useritems)) {
$pinned[] = $useritem['iid'];
}
DBA::close($useritems);
if (empty($pinned)) {
return [];
}
if (empty($condition) || !is_array($condition)) {
$condition = ['iid' => $pinned];
} else {
reset($condition);
$first_key = key($condition);
if (!is_int($first_key)) {
$condition['iid'] = $pinned;
} else {
$values_string = substr(str_repeat("?, ", count($pinned)), 0, -2);
$condition[0] = '(' . $condition[0] . ") AND `iid` IN (" . $values_string . ")";
$condition = array_merge($condition, $pinned);
}
}
return self::selectThreadForUser($uid, $selected, $condition, $params);
}
/**
* @brief returns an activity index from an activity string
*
@ -585,7 +659,7 @@ class Item extends BaseObject
'iaid' => 'internal-iaid'];
if ($usermode) {
$fields['user-item'] = ['ignored' => 'internal-user-ignored'];
$fields['user-item'] = ['pinned', 'ignored' => 'internal-user-ignored'];
}
$fields['item-activity'] = ['activity', 'activity' => 'internal-activity'];

View file

@ -715,4 +715,25 @@ class Photo extends BaseObject
return DBA::exists('photo', ['resource-id' => $guid]);
}
/**
* Tests if the link points to a locally stored picture page
*
* @param string $name Page link
* @return boolean
* @throws \Exception
*/
public static function isLocalPage($name)
{
$a = \get_app();
$base = $a->getBaseURL();
$guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
$guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);
if (empty($guid)) {
return false;
}
return DBA::exists('photo', ['resource-id' => $guid]);
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
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'])) {
return;
@ -50,9 +50,9 @@ class Server extends BaseAdminModule
self::getApp()->internalRedirect('admin/blocklist/server');
}
public static function content()
public static function content(array $parameters = [])
{
parent::content();
parent::content($parameters);
$a = self::getApp();

View file

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

View file

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

View file

@ -10,9 +10,9 @@ use Friendica\Module\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
// social and statusnet nodes this node is knowing

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
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'])) {
return;
@ -36,9 +36,9 @@ class Delete extends BaseAdminModule
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');

View file

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

View file

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

View file

@ -10,9 +10,9 @@ use Friendica\Util\Strings;
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');
$f = Config::get('system', 'logfile');

View file

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

View file

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

View file

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

View file

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

View file

@ -11,9 +11,9 @@ use Friendica\Util\Strings;
class Details extends BaseAdminModule
{
public static function post()
public static function post(array $parameters = [])
{
parent::post();
parent::post($parameters);
$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();

View file

@ -9,7 +9,7 @@ use Friendica\Util\Strings;
class Embed extends BaseAdminModule
{
public static function init()
public static function init(array $parameters = [])
{
$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();
@ -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();

View file

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

View file

@ -9,9 +9,9 @@ use Friendica\Module\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');
@ -32,9 +32,9 @@ class Tos extends BaseAdminModule
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();
$t = Renderer::getMarkupTemplate('admin/tos.tpl');

View file

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

View file

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

View file

@ -13,7 +13,7 @@ use Friendica\Core\Renderer;
*/
class Apps extends BaseModule
{
public static function init()
public static function init(array $parameters = [])
{
$privateaddons = Config::get('config', 'private_addons');
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();

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ use Friendica\Util\Network;
*/
class Feed extends BaseModule
{
public static function init()
public static function init(array $parameters = [])
{
if (!local_user()) {
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 = [];
if (!empty($_REQUEST['url'])) {

View file

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

View file

@ -10,7 +10,7 @@ use Friendica\Util\Temporal;
class Localtime extends BaseModule
{
public static function post()
public static function post(array $parameters = [])
{
$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();

View file

@ -13,7 +13,7 @@ use Friendica\Network\Probe as NetworkProbe;
*/
class Probe extends BaseModule
{
public static function content()
public static function content(array $parameters = [])
{
if (!local_user()) {
$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
{
public static function content()
public static function content(array $parameters = [])
{
if (!local_user()) {
$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
{
public static function post()
public static function post(array $parameters = [])
{
if (!local_user()) {
return;
@ -92,7 +92,7 @@ class Delegation extends BaseModule
// NOTREACHED
}
public static function content()
public static function content(array $parameters = [])
{
if (!local_user()) {
throw new ForbiddenException(L10n::t('Permission denied.'));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ use Friendica\Util\XML;
*/
class SaveTag extends BaseModule
{
public static function init()
public static function init(array $parameters = [])
{
if (!local_user()) {
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();
$logger = $a->getLogger();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -16,7 +16,7 @@ use Friendica\Util\Strings;
*/
class Invite extends BaseModule
{
public static function post()
public static function post(array $parameters = [])
{
if (!local_user()) {
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);
}
public static function content()
public static function content(array $parameters = [])
{
if (!local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));

View file

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

View file

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

View file

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

View file

@ -30,7 +30,7 @@ use LightOpenID;
*/
class Login extends BaseModule
{
public static function content()
public static function content(array $parameters = [])
{
$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);
}
public static function post()
public static function post(array $parameters = [])
{
$openid_identity = Session::get('openid_identity');
$openid_server = Session::get('openid_server');

View file

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

View file

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

View file

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

View file

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

View file

@ -13,7 +13,7 @@ use Friendica\Core\System;
*/
class NodeInfo extends BaseModule
{
public static function init()
public static function init(array $parameters = [])
{
$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();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@ use Friendica\Util\Strings;
*/
class Owa extends BaseModule
{
public static function init()
public static function init(array $parameters = [])
{
$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
* return the image
*/
public static function init()
public static function init(array $parameters = [])
{
$a = self::getApp();
// @TODO: Replace with parameter from router

40
src/Module/Pinned.php Normal file
View file

@ -0,0 +1,40 @@
<?php
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Model\Item;
/**
* Toggle pinned items
*/
class Pinned extends BaseModule
{
public static function rawContent(array $parameters = [])
{
if (!local_user()) {
throw new \Friendica\Network\HTTPException\ForbiddenException();
}
if (empty($parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
$itemId = intval($parameters['item']);
$pinned = !Item::getPinned($itemId, local_user());
Item::setPinned($itemId, local_user(), $pinned);
// See if we've been passed a return path to redirect to
$returnPath = $_REQUEST['return'] ?? '';
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((int)$pinned);
exit();
}
}

View file

@ -33,7 +33,7 @@ class Profile extends BaseModule
public static $which = '';
public static $profile = 0;
public static function init()
public static function init(array $parameters = [])
{
$a = self::getApp();
@ -51,7 +51,7 @@ class Profile extends BaseModule
}
}
public static function rawContent()
public static function rawContent(array $parameters = [])
{
if (ActivityPub::isRequest()) {
$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();
@ -177,7 +177,7 @@ class Profile extends BaseModule
}
if (!$update) {
$tab = Strings::escapeTags(trim($_GET['tab'] ?? ''));
$tab = Strings::escapeTags(trim($_GET['tab'] ?? ''));
$o .= ProfileModel::getTabs($a, $tab, $is_owner, $a->profile['nickname']);
@ -349,7 +349,13 @@ class Profile extends BaseModule
$items = DBA::toArray($items_stmt);
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'received', $a->profile['profile_uid']);
if ($pager->getStart() == 0 && !empty($a->profile['profile_uid'])) {
$pinned_items = Item::selectPinned($a->profile['profile_uid'], ['uri', 'pinned'], ['true' . $sql_extra]);
$pinned = Item::inArray($pinned_items);
$items = array_merge($items, $pinned);
}
$o .= conversation($a, $items, $pager, 'profile', $update, false, 'pinned_received', $a->profile['profile_uid']);
if (!$update) {
$o .= $pager->renderMinimal(count($items));

View file

@ -18,7 +18,7 @@ use Friendica\Util\Proxy as ProxyUtils;
class Contacts extends BaseModule
{
public static function content()
public static function content(array $parameters = [])
{
if (Config::get('system', 'block_public') && !Session::isAuthenticated()) {
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.
*
*/
public static function init()
public static function init(array $parameters = [])
{
// Set application instance here
$a = self::getApp();

View file

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

View file

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

View file

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

View file

@ -35,7 +35,7 @@ class Register extends BaseModule
*
* @return string
*/
public static function content()
public static function content(array $parameters = [])
{
// logged in users can register others (people/pages/groups)
// 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.
* Doesn't display any content
*/
public static function post()
public static function post(array $parameters = [])
{
BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');
@ -261,6 +261,11 @@ class Register extends BaseModule
$a->internalRedirect('register/');
}
// Is there text in the tar pit?
if (!empty($_POST['registertarpit'])) {
\notice(L10n::t('You have entered too much information.'));
$a->internalRedirect('register/');
}
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);

View file

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

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(array $parameters = [])
{
if (!local_user()) {
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
{
public static function content()
public static function content(array $parameters = [])
{
if (!local_user()) {
notice(L10n::t('Permission denied.'));

View file

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

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