**/
try {
$module_class = $router->getModuleClass($args->getCommand());
- $module_parameters = $router->getModuleParameters();
+ $module_parameters[] = $router->getModuleParameters();
} catch (MethodNotAllowedException $e) {
$module_class = MethodNotAllowed::class;
} catch (NotFoundException $e) {
} else {
include_once "addon/{$this->module}/{$this->module}.php";
if (function_exists($this->module . '_module')) {
- LegacyModule::setModuleFile("addon/{$this->module}/{$this->module}.php");
- $module_class = LegacyModule::class;
+ $module_parameters[] = "addon/{$this->module}/{$this->module}.php";
+ $module_class = LegacyModule::class;
}
}
}
* We emulate a Module class through the LegacyModule class
*/
if (!$module_class && file_exists("mod/{$this->module}.php")) {
- LegacyModule::setModuleFile("mod/{$this->module}.php");
- $module_class = LegacyModule::class;
+ $module_parameters[] = "mod/{$this->module}.php";
+ $module_class = LegacyModule::class;
}
$module_class = $module_class ?: PageNotFound::class;
}
/** @var ICanHandleRequests $module */
- $module = $dice->create($module_class, [$module_parameters]);
+ $module = $dice->create($module_class, $module_parameters);
return new Module($this->module, $module, $this->isBackend, $printNotAllowedAddon);
}
abstract class BaseModule implements ICanHandleRequests
{
/** @var array */
- protected static $parameters = [];
+ protected $parameters = [];
public function __construct(array $parameters = [])
{
- static::$parameters = $parameters;
+ $this->parameters = $parameters;
}
/**
*
* @var string
*/
- private static $moduleName = '';
+ private $moduleName = '';
+
+ public function __construct(string $file_path = '', array $parameters = [])
+ {
+ parent::__construct($parameters);
+
+ $this->setModuleFile($file_path);
+ }
/**
* The only method that needs to be called, with the module/addon file name.
* @param string $file_path
* @throws \Exception
*/
- public static function setModuleFile($file_path)
+ private function setModuleFile($file_path)
{
if (!is_readable($file_path)) {
throw new \Exception(DI::l10n()->t('Legacy module file not found: %s', $file_path));
}
- self::$moduleName = basename($file_path, '.php');
+ $this->moduleName = basename($file_path, '.php');
require_once $file_path;
}
public function init()
{
- self::runModuleFunction('init', static::$parameters);
+ $this->runModuleFunction('init');
}
public function content(): string
{
- return self::runModuleFunction('content', static::$parameters);
+ return $this->runModuleFunction('content');
}
public function post()
{
- self::runModuleFunction('post', static::$parameters);
+ $this->runModuleFunction('post');
}
public function afterpost()
{
- self::runModuleFunction('afterpost', static::$parameters);
+ $this->runModuleFunction('afterpost');
}
/**
* @return string
* @throws \Exception
*/
- private static function runModuleFunction($function_suffix, array $parameters = [])
+ private function runModuleFunction(string $function_suffix)
{
- $function_name = static::$moduleName . '_' . $function_suffix;
+ $function_name = $this->moduleName . '_' . $function_suffix;
if (\function_exists($function_name)) {
$a = DI::app();
return $function_name($a);
} else {
- return parent::{$function_suffix}($parameters);
+ return parent::{$function_suffix}($this->parameters);
}
}
}
{
public function rawContent()
{
- if (empty(static::$parameters['nickname'])) {
+ if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
// @TODO: Replace with parameter from router
- $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
+ $owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
{
public function rawContent()
{
- if (empty(static::$parameters['nickname'])) {
+ if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
- $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
+ $owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
$filename = 'failed-activitypub';
}
$tempfile = tempnam(System::getTempPath(), $filename);
- file_put_contents($tempfile, json_encode(['parameters' => static::$parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
+ file_put_contents($tempfile, json_encode(['parameters' => $this->parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
Logger::notice('Incoming message stored', ['file' => $tempfile]);
}
- if (!empty(static::$parameters['nickname'])) {
- $user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
+ if (!empty($this->parameters['nickname'])) {
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
if (!DBA::isResult($user)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
{
public function rawContent()
{
- if (empty(static::$parameters['guid'])) {
+ if (empty($this->parameters['guid'])) {
throw new HTTPException\BadRequestException();
}
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
}
- $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => static::$parameters['guid']]);
+ $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $this->parameters['guid']]);
if (DBA::isResult($itemuri)) {
- Logger::info('Provided GUID found.', ['guid' => static::$parameters['guid'], 'uri-id' => $itemuri['id']]);
+ Logger::info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]);
} else {
// The item URI does not always contain the GUID. This means that we have to search the URL instead
$url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString();
throw new HTTPException\NotFoundException();
}
- $etag = md5(static::$parameters['guid'] . '-' . $item['changed']);
+ $etag = md5($this->parameters['guid'] . '-' . $item['changed']);
$last_modified = $item['changed'];
Network::checkEtagModified($etag, $last_modified);
- if (empty(static::$parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
+ if (empty($this->parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
$activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
$data = ['@context' => ActivityPub::CONTEXT];
$data = array_merge($data, $activity['object']);
- } elseif (empty(static::$parameters['activity']) || in_array(static::$parameters['activity'],
+ } elseif (empty($this->parameters['activity']) || in_array($this->parameters['activity'],
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
'TentativeAccept', 'Follow', 'Add'])) {
$data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
- if (!empty(static::$parameters['activity']) && (static::$parameters['activity'] != 'Create')) {
- $data['type'] = static::$parameters['activity'];
- $data['id'] = str_replace('/Create', '/' . static::$parameters['activity'], $data['id']);
+ if (!empty($this->parameters['activity']) && ($this->parameters['activity'] != 'Create')) {
+ $data['type'] = $this->parameters['activity'];
+ $data['id'] = str_replace('/Create', '/' . $this->parameters['activity'], $data['id']);
}
} else {
throw new HTTPException\NotFoundException();
{
public function rawContent()
{
- if (empty(static::$parameters['nickname'])) {
+ if (empty($this->parameters['nickname'])) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
- $owner = User::getOwnerDataByNick(static::$parameters['nickname']);
+ $owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (empty($owner)) {
throw new \Friendica\Network\HTTPException\NotFoundException();
}
{
self::checkAdminAccess();
- $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
+ $addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
$redirect = 'admin/addons/' . $addon;
$addons_admin = Addon::getAdminList();
- $addon = Strings::sanitizeFilePathItem(static::$parameters['addon']);
+ $addon = Strings::sanitizeFilePathItem($this->parameters['addon']);
if (!is_file("addon/$addon/$addon.php")) {
notice(DI::l10n()->t('Addon not found.'));
Addon::uninstall($addon);
$a = DI::app();
- $action = static::$parameters['action'] ?? '';
- $update = static::$parameters['update'] ?? 0;
+ $action = $this->parameters['action'] ?? '';
+ $update = $this->parameters['update'] ?? 0;
switch ($action) {
case 'mark':
{
parent::content();
- $guid = basename($_REQUEST['guid'] ?? static::$parameters['guid'] ?? '');
+ $guid = basename($_REQUEST['guid'] ?? $this->parameters['guid'] ?? '');
$source = '';
$item_uri = '';
{
parent::content();
- $status = static::$parameters['status'] ?? '';
+ $status = $this->parameters['status'] ?? '';
// get jobs from the workerqueue table
if ($status == 'deferred') {
self::checkFormSecurityTokenRedirectOnError('/admin/storage', 'admin_storage');
- $storagebackend = trim(static::$parameters['name'] ?? '');
+ $storagebackend = trim($this->parameters['name'] ?? '');
try {
/** @var ICanConfigureStorage|false $newStorageConfig */
{
parent::content();
- $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t("Item not found."));
return '';
{
public function init()
{
- $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) {
DI::app()->setCurrentTheme($theme);
}
{
self::checkAdminAccess();
- $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (is_file("view/theme/$theme/config.php")) {
require_once "view/theme/$theme/config.php";
if (function_exists('theme_admin_post')) {
{
parent::content();
- $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (!is_dir("view/theme/$theme")) {
notice(DI::l10n()->t('Unknown theme.'));
return '';
{
parent::content();
- $tos = new \Friendica\Module\Tos(static::$parameters);
+ $tos = new \Friendica\Module\Tos($this->parameters);
$t = Renderer::getMarkupTemplate('admin/tos.tpl');
return Renderer::replaceMacros($t, [
'$title' => DI::l10n()->t('Administration'),
{
parent::content();
- $action = static::$parameters['action'] ?? '';
- $uid = static::$parameters['uid'] ?? 0;
+ $action = $this->parameters['action'] ?? '';
+ $uid = $this->parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
{
parent::content();
- $action = static::$parameters['action'] ?? '';
- $uid = static::$parameters['uid'] ?? 0;
+ $action = $this->parameters['action'] ?? '';
+ $uid = $this->parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
{
parent::content();
- $action = static::$parameters['action'] ?? '';
- $uid = static::$parameters['uid'] ?? 0;
+ $action = $this->parameters['action'] ?? '';
+ $uid = $this->parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
{
parent::content();
- $action = static::$parameters['action'] ?? '';
- $uid = static::$parameters['uid'] ?? 0;
+ $action = $this->parameters['action'] ?? '';
+ $uid = $this->parameters['uid'] ?? 0;
if ($uid) {
$user = User::getById($uid, ['username', 'blocked']);
'id' => 0, // Id of the post
]);
- $res = Item::performActivity($request['id'], static::$parameters['verb'], $uid);
+ $res = Item::performActivity($request['id'], $this->parameters['verb'], $uid);
if ($res) {
- if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
+ if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true';
} else {
$ok = 'ok';
}
- DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('ok', ['ok' => $ok], $this->parameters['extension'] ?? null);
} else {
- DI::apiResponse()->error(500, 'Error adding activity', '', static::$parameters['extension'] ?? null);
+ DI::apiResponse()->error(500, 'Error adding activity', '', $this->parameters['extension'] ?? null);
}
}
}
// return error if id is zero
if (empty($request['id'])) {
$answer = ['result' => 'error', 'message' => 'message id not specified'];
- DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
}
// error message if specified id is not in database
if (!DBA::exists('mail', ['id' => $request['id'], 'uid' => $uid])) {
$answer = ['result' => 'error', 'message' => 'message id not in database'];
- DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
}
// update seen indicator
$answer = ['result' => 'error', 'message' => 'unknown error'];
}
- DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('direct_messages_setseen', ['$result' => $answer], $this->parameters['extension'] ?? null);
}
}
];
}
- DI::apiResponse()->exit('events', ['events' => $items], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('events', ['events' => $items], $this->parameters['extension'] ?? null);
}
}
$notifications[] = new ApiNotification($Notify);
}
- if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
+ if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$xmlnotes = [];
foreach ($notifications as $notification) {
$xmlnotes[] = ['@attributes' => $notification->toArray()];
$result = false;
}
- DI::apiResponse()->exit('notes', ['note' => $result], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('notes', ['note' => $result], $this->parameters['extension'] ?? null);
}
}
Item::deleteForUser($condition, $uid);
$result = ['result' => 'deleted', 'message' => 'photo with id `' . $request['photo_id'] . '` has been deleted from server.'];
- DI::apiResponse()->exit('photo_delete', ['$result' => $result], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('photo_delete', ['$result' => $result], $this->parameters['extension'] ?? null);
} else {
throw new InternalServerErrorException("unknown error on deleting photo from database table");
}
// return success of deletion or error message
if ($result) {
$answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
- DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('photoalbum_delete', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else {
throw new InternalServerErrorException("unknown error - deleting from database failed");
}
// return success of updating or error message
if ($result) {
$answer = ['result' => 'updated', 'message' => 'album `' . $request['album'] . '` with all containing photos has been renamed to `' . $request['album_new'] . '`.'];
- DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('photoalbum_update', ['$result' => $answer], $this->parameters['extension'] ?? null);
} else {
throw new InternalServerErrorException("unknown error - updating in database failed");
}
$profile = self::formatProfile($profile, $profileFields);
$profiles = [];
- if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
+ if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$profiles['0:profile'] = $profile;
} else {
$profiles[] = $profile;
'profiles' => $profiles
];
- DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('friendica_profiles', ['$result' => $result], $this->parameters['extension'] ?? null);
}
/**
{
public function rawContent()
{
- DI::apiResponse()->exit('version', ['version' => '0.9.7'], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('version', ['version' => '0.9.7'], $this->parameters['extension'] ?? null);
}
}
{
public function rawContent()
{
- if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
+ if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$ok = 'true';
} else {
$ok = 'ok';
}
- DI::apiResponse()->exit('ok', ['ok' => $ok], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('ok', ['ok' => $ok], $this->parameters['extension'] ?? null);
}
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id']) && empty(static::$parameters['name'])) {
+ if (empty($this->parameters['id']) && empty($this->parameters['name'])) {
DI::mstdnError()->UnprocessableEntity();
}
- if (!empty(static::$parameters['id'])) {
- $id = static::$parameters['id'];
+ if (!empty($this->parameters['id'])) {
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
} else {
- $contact = Contact::selectFirst(['id'], ['nick' => static::$parameters['name'], 'uid' => 0]);
+ $contact = Contact::selectFirst(['id'], ['nick' => $this->parameters['name'], 'uid' => 0]);
if (!empty($contact['id'])) {
$id = $contact['id'];
- } elseif (!($id = Contact::getIdForURL(static::$parameters['name'], 0, false))) {
+ } elseif (!($id = Contact::getIdForURL($this->parameters['name'], 0, false))) {
DI::mstdnError()->RecordNotFound();
}
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
DI::mstdnError()->Forbidden();
}
- $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
+ $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
Contact::terminateFriendship($owner, $contact);
Contact::revokeFollow($contact);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $cid = Contact::follow(static::$parameters['id'], $uid);
+ $cid = Contact::follow($this->parameters['id'], $uid);
System::jsonExit(DI::mstdnRelationship()->createFromContactId($cid, $uid)->toArray());
}
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$params['order'] = ['cid'];
}
- $followers = DBA::select('contact-relation', ['relation-cid'], $condition, static::$parameters);
+ $followers = DBA::select('contact-relation', ['relation-cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['relation-cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid);
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$params['order'] = ['cid'];
}
- $followers = DBA::select('contact-relation', ['cid'], $condition, static::$parameters);
+ $followers = DBA::select('contact-relation', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- Contact\User::setIgnored(static::$parameters['id'], $uid, true);
+ Contact\User::setIgnored($this->parameters['id'], $uid, true);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
'comment' => '',
]);
- $cdata = Contact::getPublicAndUserContactID(static::$parameters['id'], $uid);
+ $cdata = Contact::getPublicAndUserContactID($this->parameters['id'], $uid);
if (empty($cdata['user'])) {
DI::mstdnError()->RecordNotFound();
}
Contact::update(['info' => $request['comment']], ['id' => $cdata['user']]);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- Contact\User::setBlocked(static::$parameters['id'], $uid, false);
+ Contact\User::setBlocked($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- Contact::unfollow(static::$parameters['id'], $uid);
+ Contact::unfollow($this->parameters['id'], $uid);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- Contact\User::setIgnored(static::$parameters['id'], $uid, false);
+ Contact\User::setIgnored($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnRelationship()->createFromContactId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnRelationship()->createFromContactId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$params['order'] = ['cid'];
}
- $followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters);
+ $followers = DBA::select('user-contact', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (!empty(static::$parameters['id'])) {
+ if (!empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- DBA::delete('conv', ['id' => static::$parameters['id'], 'uid' => $uid]);
- DBA::delete('mail', ['convid' => static::$parameters['id'], 'uid' => $uid]);
+ DBA::delete('conv', ['id' => $this->parameters['id'], 'uid' => $uid]);
+ DBA::delete('mail', ['convid' => $this->parameters['id'], 'uid' => $uid]);
System::jsonExit([]);
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (!empty(static::$parameters['id'])) {
+ if (!empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- DBA::update('mail', ['seen' => true], ['convid' => static::$parameters['id'], 'uid' => $uid]);
+ DBA::update('mail', ['seen' => true], ['convid' => $this->parameters['id'], 'uid' => $uid]);
- System::jsonExit(DI::mstdnConversation()->CreateFromConvId(static::$parameters['id'])->toArray());
+ System::jsonExit(DI::mstdnConversation()->CreateFromConvId($this->parameters['id'])->toArray());
}
}
self::checkAllowedScope(self::SCOPE_FOLLOW);
$uid = self::getCurrentUserID();
- $introduction = DI::intro()->selectOneById(static::$parameters['id'], $uid);
+ $introduction = DI::intro()->selectOneById($this->parameters['id'], $uid);
$contactId = $introduction->cid;
- switch (static::$parameters['action']) {
+ switch ($this->parameters['action']) {
case 'authorize':
Contact\Introduction::confirm($introduction);
$relationship = DI::mstdnRelationship()->createFromContactId($contactId, $uid);
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- if (!Group::exists(static::$parameters['id'], $uid)) {
+ if (!Group::exists($this->parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound();
}
- if (!Group::remove(static::$parameters['id'])) {
+ if (!Group::remove($this->parameters['id'])) {
DI::mstdnError()->InternalError();
}
'replies_policy' => '', // One of: "followed", "list", or "none".
]);
- if (empty($request['title']) || empty(static::$parameters['id'])) {
+ if (empty($request['title']) || empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- Group::update(static::$parameters['id'], $request['title']);
+ Group::update($this->parameters['id'], $request['title']);
}
/**
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
$lists = [];
$groups = Group::getByUserId($uid);
$lists[] = DI::mstdnList()->createFromGroupId($group['id']);
}
} else {
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound();
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('group', ['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}
'focus' => '', // Two floating points (x,y), comma-delimited ranging from -1.0 to 1.0
]);
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $photo = Photo::selectFirst(['resource-id'], ['id' => static::$parameters['id'], 'uid' => $uid]);
+ $photo = Photo::selectFirst(['resource-id'], ['id' => $this->parameters['id'], 'uid' => $uid]);
if (empty($photo['resource-id'])) {
DI::mstdnError()->RecordNotFound();
}
Photo::update(['desc' => $request['description']], ['resource-id' => $photo['resource-id']]);
- System::jsonExit(DI::mstdnAttachment()->createFromPhoto(static::$parameters['id']));
+ System::jsonExit(DI::mstdnAttachment()->createFromPhoto($this->parameters['id']));
}
/**
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!Photo::exists(['id' => $id, 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) {
DI::mstdnError()->RecordNotFound();
}
$params['order'] = ['cid'];
}
- $followers = DBA::select('user-contact', ['cid'], $condition, static::$parameters);
+ $followers = DBA::select('user-contact', ['cid'], $condition, $this->parameters);
while ($follower = DBA::fetch($followers)) {
self::setBoundaries($follower['cid']);
$accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid);
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (!empty(static::$parameters['id'])) {
- $id = static::$parameters['id'];
+ if (!empty($this->parameters['id'])) {
+ $id = $this->parameters['id'];
try {
$notification = DI::notification()->selectOneForUser($uid, ['id' => $id]);
System::jsonExit(DI::mstdnNotification()->createFromNotification($notification));
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $Notification = DI::notification()->selectOneForUser($uid, static::$parameters['id']);
+ $Notification = DI::notification()->selectOneForUser($uid, $this->parameters['id']);
$Notification->setSeen();
DI::notification()->save($Notification);
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- if (!DBA::exists('delayed-post', ['id' => static::$parameters['id'], 'uid' => $uid])) {
+ if (!DBA::exists('delayed-post', ['id' => $this->parameters['id'], 'uid' => $uid])) {
DI::mstdnError()->RecordNotFound();
}
- Post\Delayed::deleteById(static::$parameters['id']);
+ Post\Delayed::deleteById($this->parameters['id']);
System::jsonExit([]);
}
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (isset(static::$parameters['id'])) {
- System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId(static::$parameters['id'], $uid)->toArray());
+ if (isset($this->parameters['id'])) {
+ System::jsonExit(DI::mstdnScheduledStatus()->createFromDelayedPostId($this->parameters['id'], $uid)->toArray());
}
$request = self::getRequest([
$result['statuses'] = self::searchStatuses($uid, $request['q'], $request['account_id'], $request['max_id'], $request['min_id'], $limit, $request['offset']);
}
if ((empty($request['type']) || ($request['type'] == 'hashtags')) && (strpos($request['q'], '@') == false)) {
- $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], static::$parameters['version']);
+ $result['hashtags'] = self::searchHashtags($request['q'], $request['exclude_unreviewed'], $limit, $request['offset'], $this->parameters['version']);
}
System::jsonExit($result);
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => $uid]);
+ $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => $uid]);
if (empty($item['id'])) {
DI::mstdnError()->RecordNotFound();
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid));
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid));
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::update(['starred' => true], ['id' => $item['id']]);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
throw new HTTPException\NotFoundException('Item with URI ID ' . $id . ' not found' . ($uid ? ' for user ' . $uid : '.'));
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
'limit' => 40, // Maximum number of results to return. Defaults to 40.
]);
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
$parents = [];
$children = [];
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::performActivity($item['id'], 'like', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be muted'));
}
- Post\ThreadUser::setIgnored(static::$parameters['id'], $uid, true);
+ Post\ThreadUser::setIgnored($this->parameters['id'], $uid, true);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned'));
}
- Post\ThreadUser::setPinned(static::$parameters['id'], $uid, true);
+ Post\ThreadUser::setPinned($this->parameters['id'], $uid, true);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::performActivity($item['id'], 'announce', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
{
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $id = static::$parameters['id'];
+ $id = $this->parameters['id'];
if (!Post::exists(['uri-id' => $id, 'uid' => [0, $uid]])) {
DI::mstdnError()->RecordNotFound();
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::update(['starred' => false], ['id' => $item['id']]);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::performActivity($item['id'], 'unlike', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be unmuted'));
}
- Post\ThreadUser::setIgnored(static::$parameters['id'], $uid, false);
+ Post\ThreadUser::setIgnored($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'gravity'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Only starting posts can be pinned'));
}
- Post\ThreadUser::setPinned(static::$parameters['id'], $uid, false);
+ Post\ThreadUser::setPinned($this->parameters['id'], $uid, false);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_WRITE);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
- $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => static::$parameters['id'], 'uid' => [$uid, 0]]);
+ $item = Post::selectFirstForUser($uid, ['id', 'network'], ['uri-id' => $this->parameters['id'], 'uid' => [$uid, 0]]);
if (!DBA::isResult($item)) {
DI::mstdnError()->RecordNotFound();
}
Item::performActivity($item['id'], 'unannounce', $uid);
- System::jsonExit(DI::mstdnStatus()->createFromUriId(static::$parameters['id'], $uid)->toArray());
+ System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray());
}
}
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)",
- $uid, GRAVITY_PARENT, GRAVITY_COMMENT, static::$parameters['id']];
+ $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $this->parameters['id']];
if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);
self::checkAllowedScope(self::SCOPE_READ);
$uid = self::getCurrentUserID();
- if (empty(static::$parameters['hashtag'])) {
+ if (empty($this->parameters['hashtag'])) {
DI::mstdnError()->UnprocessableEntity();
}
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
- static::$parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
+ $this->parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
if ($request['local']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
{
public function rawContent()
{
- if (!empty(static::$parameters['extension']) && (static::$parameters['extension'] == 'xml')) {
+ if (!empty($this->parameters['extension']) && ($this->parameters['extension'] == 'xml')) {
$hash = [
'remaining-hits' => '150',
'@attributes' => ["type" => "integer"],
];
}
- DI::apiResponse()->exit('hash', ['hash' => $hash], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('hash', ['hash' => $hash], $this->parameters['extension'] ?? null);
}
}
DBA::close($terms);
- DI::apiResponse()->exit('terms', ['terms' => $result], static::$parameters['extension'] ?? null);
+ DI::apiResponse()->exit('terms', ['terms' => $result], $this->parameters['extension'] ?? null);
}
}
public function rawContent()
{
$a = DI::app();
- if (empty(static::$parameters['item'])) {
+ if (empty($this->parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
- $item_id = intval(static::$parameters['item']);
+ $item_id = intval($this->parameters['item']);
// Check for existence
$item = MAttach::exists(['id' => $item_id]);
public function post()
{
- $cid = static::$parameters['id'];
+ $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {
public function content(): string
{
- $cid = static::$parameters['id'];
+ $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {
throw new HTTPException\ForbiddenException();
}
- $cid = static::$parameters['id'];
- $type = static::$parameters['type'] ?? 'all';
+ $cid = $this->parameters['id'];
+ $type = $this->parameters['type'] ?? 'all';
$accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype);
{
public function content(): string
{
- $cid = static::$parameters['id'];
+ $cid = $this->parameters['id'];
$contact = Model\Contact::selectFirst([], ['id' => $cid]);
if (empty($contact)) {
{
public function post()
{
- if (!local_user() || empty(static::$parameters['id'])) {
+ if (!local_user() || empty($this->parameters['id'])) {
return self::postReturn(false);
}
$activity = Activity::POKE . '#' . urlencode($verbs[$verb][0]);
- $contact_id = intval(static::$parameters['id']);
+ $contact_id = intval($this->parameters['id']);
if (!$contact_id) {
return self::postReturn(false);
}
Logger::info('verb ' . $verb . ' contact ' . $contact_id);
- $contact = DBA::selectFirst('contact', ['id', 'name', 'url', 'photo'], ['id' => static::$parameters['id'], 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', ['id', 'name', 'url', 'photo'], ['id' => $this->parameters['id'], 'uid' => local_user()]);
if (!DBA::isResult($contact)) {
return self::postReturn(false);
}
throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this module.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $contact = DBA::selectFirst('contact', ['id', 'url', 'name'], ['id' => static::$parameters['id'], 'uid' => local_user()]);
+ $contact = DBA::selectFirst('contact', ['id', 'url', 'name'], ['id' => $this->parameters['id'], 'uid' => local_user()]);
if (!DBA::isResult($contact)) {
throw new HTTPException\NotFoundException();
}
return;
}
- $data = Model\Contact::getPublicAndUserContactID(static::$parameters['id'], local_user());
+ $data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], local_user());
if (!DBA::isResult($data)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Unknown contact.'));
}
throw new HTTPException\UnauthorizedException();
}
- self::checkFormSecurityTokenRedirectOnError('contact/' . static::$parameters['id'], 'contact_revoke');
+ self::checkFormSecurityTokenRedirectOnError('contact/' . $this->parameters['id'], 'contact_revoke');
$result = Model\Contact::revokeFollow(self::$contact);
if ($result === true) {
notice(DI::l10n()->t('Unable to revoke follow, please try again later or contact the administrator.'));
}
- DI::baseUrl()->redirect('contact/' . static::$parameters['id']);
+ DI::baseUrl()->redirect('contact/' . $this->parameters['id']);
}
public function content(): string
public function content(): string
{
- self::parseRequest();
+ $this->parseRequest();
if (DI::pConfig()->get(local_user(), 'system', 'infinite_scroll')) {
$tpl = Renderer::getMarkupTemplate('infinite_scroll_head.tpl');
if (local_user() && DI::config()->get('system', 'community_no_sharer')) {
$path = self::$content;
- if (!empty(static::$parameters['accounttype'])) {
- $path .= '/' . static::$parameters['accounttype'];
+ if (!empty($this->parameters['accounttype'])) {
+ $path .= '/' . $this->parameters['accounttype'];
}
$query_parameters = [];
* @throws HTTPException\BadRequestException
* @throws HTTPException\ForbiddenException
*/
- protected static function parseRequest()
+ protected function parseRequest()
{
if (DI::config()->get('system', 'block_public') && !Session::isAuthenticated()) {
throw new HTTPException\ForbiddenException(DI::l10n()->t('Public access denied.'));
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
- self::$accountTypeString = $_GET['accounttype'] ?? static::$parameters['accounttype'] ?? '';
+ self::$accountTypeString = $_GET['accounttype'] ?? $this->parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
- self::$content = static::$parameters['content'] ?? '';
+ self::$content = $this->parameters['content'] ?? '';
if (!self::$content) {
if (!empty(DI::config()->get('system', 'singleuser'))) {
// On single user systems only the global page does make sense
return Login::form();
}
- self::parseRequest($_GET);
+ $this->parseRequest($_GET);
$module = 'network';
return Renderer::replaceMacros($tpl, ['$tabs' => $arr['tabs']]);
}
- protected static function parseRequest(array $get)
+ protected function parseRequest(array $get)
{
- self::$groupId = static::$parameters['group_id'] ?? 0;
+ self::$groupId = $this->parameters['group_id'] ?? 0;
- self::$forumContactId = static::$parameters['contact_id'] ?? 0;
+ self::$forumContactId = $this->parameters['contact_id'] ?? 0;
self::$selectedTab = Session::get('network-tab', DI::pConfig()->get(local_user(), 'network.view', 'selected_tab', ''));
Session::set('network-tab', self::$selectedTab);
DI::pConfig()->set(local_user(), 'network.view', 'selected_tab', self::$selectedTab);
- self::$accountTypeString = $get['accounttype'] ?? static::$parameters['accounttype'] ?? '';
+ self::$accountTypeString = $get['accounttype'] ?? $this->parameters['accounttype'] ?? '';
self::$accountType = User::getAccountTypeByString(self::$accountTypeString);
self::$network = $get['nets'] ?? '';
- self::$dateFrom = static::$parameters['from'] ?? '';
- self::$dateTo = static::$parameters['to'] ?? '';
+ self::$dateFrom = $this->parameters['from'] ?? '';
+ self::$dateTo = $this->parameters['to'] ?? '';
if (DI::mode()->isMobile()) {
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
}
$data = json_decode($postdata);
- if (is_object($data) && !empty(static::$parameters['nickname'])) {
- $user = User::getByNickname(static::$parameters['nickname']);
+ if (is_object($data) && !empty($this->parameters['nickname'])) {
+ $user = User::getByNickname($this->parameters['nickname']);
if (empty($user)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}
{
header("Content-type: application/atom+xml");
$last_update = $_GET['last_update'] ?? '';
- echo OStatus::feed(static::$parameters['nickname'], $last_update, 10);
+ echo OStatus::feed($this->parameters['nickname'], $last_update, 10);
exit();
}
}
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.'));
}
- if (empty(static::$parameters['item'])) {
+ if (empty($this->parameters['item'])) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.'));
}
- $itemId = intval(static::$parameters['item']);
+ $itemId = intval($this->parameters['item']);
$item = Post::selectFirst(['body'], ['uid' => [0, local_user()], 'uri-id' => $itemId]);
{
public function rawContent()
{
- if (empty(static::$parameters['guid'])) {
+ if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException();
}
- $guid = static::$parameters['guid'];
+ $guid = $this->parameters['guid'];
// Fetch the item
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,
throw new HTTPException\ForbiddenException(DI::l10n()->t('Access denied.'));
}
- if (static::$parameters['type'] === 'public') {
+ if ($this->parameters['type'] === 'public') {
self::receivePublic();
- } else if (static::$parameters['type'] === 'users') {
- self::receiveUser(static::$parameters['guid']);
+ } else if ($this->parameters['type'] === 'users') {
+ self::receiveUser($this->parameters['guid']);
}
}
}
header("Content-type: application/atom+xml; charset=utf-8");
- echo ProtocolFeed::atom(static::$parameters['nickname'], $last_update, 10, $type, $nocache, true);
+ echo ProtocolFeed::atom($this->parameters['nickname'], $last_update, 10, $type, $nocache, true);
exit();
}
}
$logger = DI::logger();
- $item_id = static::$parameters['id'] ?? 0;
+ $item_id = $this->parameters['id'] ?? 0;
$term = XML::unescape(trim($_GET['term'] ?? ''));
$cat = XML::unescape(trim($_GET['cat'] ?? ''));
$term = XML::unescape(trim($_GET['term'] ?? ''));
- $item_id = static::$parameters['id'] ?? 0;
+ $item_id = $this->parameters['id'] ?? 0;
$logger->info('filer', ['tag' => $term, 'item' => $item_id]);
public function post()
{
- $cid = intval(static::$parameters['contact']);
+ $cid = intval($this->parameters['contact']);
// We do query the "uid" as well to ensure that it is our contact
if (!DI::dba()->exists('contact', ['id' => $cid, 'uid' => local_user()])) {
public function content(): string
{
- $cid = intval(static::$parameters['contact']);
+ $cid = intval($this->parameters['contact']);
$contact = DI::dba()->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]);
if (empty($contact)) {
{
public function content(): string
{
- if ((local_user()) && (static::$parameters['action'] ?? '') === 'view') {
+ if ((local_user()) && ($this->parameters['action'] ?? '') === 'view') {
// A logged in user views a profile of a user
$nickname = DI::app()->getLoggedInUserNickname();
- } elseif (empty(static::$parameters['action'])) {
+ } elseif (empty($this->parameters['action'])) {
// Show the profile hCard
- $nickname = static::$parameters['profile'];
+ $nickname = $this->parameters['profile'];
} else {
throw new HTTPException\NotFoundException(DI::l10n()->t('No profile'));
}
throw new HTTPException\ForbiddenException();
}
- if (empty(static::$parameters['id']) || empty(static::$parameters['verb'])) {
+ if (empty($this->parameters['id']) || empty($this->parameters['verb'])) {
throw new HTTPException\BadRequestException();
}
- $verb = static::$parameters['verb'];
- $itemId = static::$parameters['id'];
+ $verb = $this->parameters['verb'];
+ $itemId = $this->parameters['id'];
if (in_array($verb, ['announce', 'unannounce'])) {
$item = Post::selectFirst(['network'], ['id' => $itemId]);
}
/// @TODO Retrieve parameter from router
- $posttype = static::$parameters['type'] ?? Item::PT_ARTICLE;
+ $posttype = $this->parameters['type'] ?? Item::PT_ARTICLE;
if (!in_array($posttype, [Item::PT_ARTICLE, Item::PT_PERSONAL_NOTE])) {
switch ($posttype) {
case 'note':
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval(static::$parameters['id']);
+ $itemId = intval($this->parameters['id']);
if (!Item::performActivity($itemId, 'follow', local_user())) {
throw new HTTPException\BadRequestException($l10n->t('Unable to follow this item.'));
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval(static::$parameters['id']);
+ $itemId = intval($this->parameters['id']);
$dba = DI::dba();
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval(static::$parameters['id']);
+ $itemId = intval($this->parameters['id']);
$item = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId]);
if (!DBA::isResult($item)) {
throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
}
- if (empty(static::$parameters['id'])) {
+ if (empty($this->parameters['id'])) {
throw new HTTPException\BadRequestException();
}
- $itemId = intval(static::$parameters['id']);
+ $itemId = intval($this->parameters['id']);
$item = Post::selectFirstForUser(local_user(), ['uid', 'uri-id', 'starred'], ['uid' => [0, local_user()], 'id' => $itemId]);
{
$a = DI::app();
- if (isset(static::$parameters['nick'])) {
+ if (isset($this->parameters['nick'])) {
// Get infos about a specific nick (public)
- $which = static::$parameters['nick'];
- } elseif (local_user() && isset(static::$parameters['profile']) && DI::args()->get(2) == 'view') {
+ $which = $this->parameters['nick'];
+ } elseif (local_user() && isset($this->parameters['profile']) && DI::args()->get(2) == 'view') {
// view infos about a known profile (needs a login)
$which = $a->getLoggedInUserNickname();
} else {
throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.'));
}
- $request_id = static::$parameters['id'] ?? false;
+ $request_id = $this->parameters['id'] ?? false;
if ($request_id) {
$intro = DI::intro()->selectOneById($request_id, local_user());
return Login::form();
}
- $request_id = static::$parameters['id'] ?? false;
+ $request_id = $this->parameters['id'] ?? false;
if ($request_id) {
$Notify = DI::notify()->selectOneById($request_id);
{
public function rawContent()
{
- $type = static::$parameters['type'];
- $referenceId = static::$parameters['id'];
+ $type = $this->parameters['type'];
+ $referenceId = $this->parameters['id'];
$expectedTypes = ['item', 'photo', 'event'];
if (!in_array($type, $expectedTypes)) {
$scale = null;
$stamp = microtime(true);
// User avatar
- if (!empty(static::$parameters['type'])) {
- if (!empty(static::$parameters['customsize'])) {
- $customsize = intval(static::$parameters['customsize']);
- $square_resize = !in_array(static::$parameters['type'], ['media', 'preview']);
+ if (!empty($this->parameters['type'])) {
+ if (!empty($this->parameters['customsize'])) {
+ $customsize = intval($this->parameters['customsize']);
+ $square_resize = !in_array($this->parameters['type'], ['media', 'preview']);
}
- if (!empty(static::$parameters['guid'])) {
- $guid = static::$parameters['guid'];
+ if (!empty($this->parameters['guid'])) {
+ $guid = $this->parameters['guid'];
$account = DBA::selectFirst('account-user-view', ['id'], ['guid' => $guid], ['order' => ['uid' => true]]);
if (empty($account)) {
throw new HTTPException\NotFoundException();
}
// Contact Id Fallback, to remove after version 2021.12
- if (isset(static::$parameters['contact_id'])) {
- $id = intval(static::$parameters['contact_id']);
+ if (isset($this->parameters['contact_id'])) {
+ $id = intval($this->parameters['contact_id']);
}
- if (!empty(static::$parameters['nickname_ext'])) {
- $nickname = pathinfo(static::$parameters['nickname_ext'], PATHINFO_FILENAME);
+ if (!empty($this->parameters['nickname_ext'])) {
+ $nickname = pathinfo($this->parameters['nickname_ext'], PATHINFO_FILENAME);
$user = User::getByNickname($nickname, ['uid']);
if (empty($user)) {
throw new HTTPException\NotFoundException();
}
// User Id Fallback, to remove after version 2021.12
- if (!empty(static::$parameters['uid_ext'])) {
- $id = intval(pathinfo(static::$parameters['uid_ext'], PATHINFO_FILENAME));
+ if (!empty($this->parameters['uid_ext'])) {
+ $id = intval(pathinfo($this->parameters['uid_ext'], PATHINFO_FILENAME));
}
// Please refactor this for the love of everything that's good
- if (isset(static::$parameters['id'])) {
- $id = static::$parameters['id'];
+ if (isset($this->parameters['id'])) {
+ $id = $this->parameters['id'];
}
if (empty($id)) {
- Logger::notice('No picture id was detected', ['parameters' => static::$parameters, 'query' => DI::args()->getQueryString()]);
+ Logger::notice('No picture id was detected', ['parameters' => $this->parameters, 'query' => DI::args()->getQueryString()]);
throw new HTTPException\NotFoundException(DI::l10n()->t('The Photo is not available.'));
}
- $photo = self::getPhotoByid($id, static::$parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
+ $photo = self::getPhotoByid($id, $this->parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
} else {
- $photoid = pathinfo(static::$parameters['name'], PATHINFO_FILENAME);
+ $photoid = pathinfo($this->parameters['name'], PATHINFO_FILENAME);
$scale = 0;
if (substr($photoid, -2, 1) == "-") {
$scale = intval(substr($photoid, -1, 1));
Nav::setSelected('home');
- $nickname = static::$parameters['nickname'];
+ $nickname = $this->parameters['nickname'];
$profile = Profile::load($a, $nickname);
if (empty($profile)) {
$a = DI::app();
- $nickname = static::$parameters['nickname'];
- $type = static::$parameters['type'] ?? 'all';
+ $nickname = $this->parameters['nickname'];
+ $type = $this->parameters['type'] ?? 'all';
$profile = Model\Profile::load($a, $nickname);
if (empty($profile)) {
{
public function rawContent()
{
- (new Profile(static::$parameters))->rawContent();
+ (new Profile($this->parameters))->rawContent();
}
public function content(): string
{
- return (new Status(static::$parameters))->content();
+ return (new Status($this->parameters))->content();
}
}
{
$a = DI::app();
- $profile = ProfileModel::load($a, static::$parameters['nickname']);
+ $profile = ProfileModel::load($a, $this->parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
public function rawContent()
{
if (ActivityPub::isRequest()) {
- $user = DBA::selectFirst('user', ['uid'], ['nickname' => static::$parameters['nickname']]);
+ $user = DBA::selectFirst('user', ['uid'], ['nickname' => $this->parameters['nickname']]);
if (DBA::isResult($user)) {
try {
$data = ActivityPub\Transmitter::getProfile($user['uid']);
}
}
- if (DBA::exists('userd', ['username' => static::$parameters['nickname']])) {
+ if (DBA::exists('userd', ['username' => $this->parameters['nickname']])) {
// Known deleted user
- $data = ActivityPub\Transmitter::getDeletedUser(static::$parameters['nickname']);
+ $data = ActivityPub\Transmitter::getDeletedUser($this->parameters['nickname']);
System::jsonError(410, $data);
} else {
{
$a = DI::app();
- $profile = ProfileModel::load($a, static::$parameters['nickname']);
+ $profile = ProfileModel::load($a, $this->parameters['nickname']);
if (!$profile) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Profile not found.'));
}
DI::page()['htmlhead'] .= '<meta name="friendica.community" content="true" />' . "\n";
}
- DI::page()['htmlhead'] .= self::buildHtmlHead($profile, static::$parameters['nickname'], $remote_contact_id);
+ DI::page()['htmlhead'] .= self::buildHtmlHead($profile, $this->parameters['nickname'], $remote_contact_id);
Nav::setSelected('home');
$view_as_contact_alert = DI::l10n()->t(
'You\'re currently viewing your profile as <b>%s</b> <a href="%s" class="btn btn-sm pull-right">Cancel</a>',
htmlentities($view_as_contacts[$key]['name'], ENT_COMPAT, 'UTF-8'),
- 'profile/' . static::$parameters['nickname'] . '/profile'
+ 'profile/' . $this->parameters['nickname'] . '/profile'
);
}
}
'$form_security_token' => BaseModule::getFormSecurityToken("profile_schedule"),
'$baseurl' => DI::baseUrl()->get(true),
'$title' => DI::l10n()->t('Scheduled Posts'),
- '$nickname' => static::$parameters['nickname'] ?? '',
+ '$nickname' => $this->parameters['nickname'] ?? '',
'$scheduled_at' => DI::l10n()->t('Scheduled'),
'$content' => DI::l10n()->t('Content'),
'$delete' => DI::l10n()->t('Remove post'),
$a = DI::app();
- $profile = ProfileModel::load($a, static::$parameters['nickname']);
+ $profile = ProfileModel::load($a, $this->parameters['nickname']);
if (empty($profile)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
}
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . static::$parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
- DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . static::$parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . $this->parameters['nickname'] . '" title="DFRN: ' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $this->parameters['nickname'] . '/" title="' . DI::l10n()->t('%s\'s posts', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $this->parameters['nickname'] . '/comments" title="' . DI::l10n()->t('%s\'s comments', $profile['name']) . '"/>' . "\n";
+ DI::page()['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . $this->parameters['nickname'] . '/activity" title="' . DI::l10n()->t('%s\'s timeline', $profile['name']) . '"/>' . "\n";
$category = $datequery = $datequery2 = '';
*/
public function rawContent()
{
- $request = self::getRequestInfo();
+ $request = $this->getRequestInfo();
if (!DI::config()->get('system', 'proxify_content')) {
Logger::notice('Proxy access is forbidden', ['request' => $request, 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'accept' => $_SERVER['HTTP_ACCEPT'] ?? '']);
* ]
* @throws \Exception
*/
- private static function getRequestInfo()
+ private function getRequestInfo()
{
$size = ProxyUtils::PIXEL_LARGE;
$sizetype = '';
- if (!empty(static::$parameters['url']) && empty($_REQUEST['url'])) {
- $url = static::$parameters['url'];
+ if (!empty($this->parameters['url']) && empty($_REQUEST['url'])) {
+ $url = $this->parameters['url'];
// thumb, small, medium and large.
if (substr($url, -6) == ':micro') {
{
public function rawContent()
{
- if (empty(static::$parameters['nick'])) {
+ if (empty($this->parameters['nick'])) {
throw new BadRequestException();
}
- $nick = static::$parameters['nick'];
+ $nick = $this->parameters['nick'];
$user = User::getByNickname($nick, ['spubkey']);
if (empty($user) || empty($user['spubkey'])) {
$tpl = $arr['template'];
- $tos = new Tos(static::$parameters);
+ $tos = new Tos($this->parameters);
$o = Renderer::replaceMacros($tpl, [
'$invitations' => DI::config()->get('system', 'invitation_only'),
public function init()
{
- self::$owner = User::getOwnerDataByNick(static::$parameters['profile']);
+ self::$owner = User::getOwnerDataByNick($this->parameters['profile']);
if (!self::$owner) {
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
}
'$submit' => DI::l10n()->t('Submit Request'),
'$cancel' => DI::l10n()->t('Cancel'),
- '$request' => 'remote_follow/' . static::$parameters['profile'],
+ '$request' => 'remote_follow/' . $this->parameters['profile'],
'$name' => self::$owner['name'],
'$myaddr' => Profile::getMyURL(),
]);
return;
}
- $photo_prefix = static::$parameters['guid'];
+ $photo_prefix = $this->parameters['guid'];
$resource_id = $photo_prefix;
$scale = 0;
if (substr($photo_prefix, -2, 1) == '-') {
parent::content();
- $resource_id = static::$parameters['guid'];
+ $resource_id = $this->parameters['guid'];
$photos = Photo::selectToArray([], ['resource-id' => $resource_id, 'uid' => local_user()], ['order' => ['scale' => false]]);
if (!DBA::isResult($photos)) {
{
header('Content-Type: text/css');
- $theme = Strings::sanitizeFilePathItem(static::$parameters['theme']);
+ $theme = Strings::sanitizeFilePathItem($this->parameters['theme']);
if (file_exists("view/theme/$theme/theme.php")) {
require_once "view/theme/$theme/theme.php";
{
public function rawContent()
{
- self::parseRequest();
+ $this->parseRequest();
$o = '';
if (!empty($_GET['force']) || !DI::pConfig()->get(local_user(), 'system', 'no_auto_update')) {
exit();
}
- self::parseRequest($_GET);
+ $this->parseRequest($_GET);
$profile_uid = intval($_GET['p']);