Fix code style

This commit is contained in:
Art4 2025-01-13 13:31:54 +00:00
parent d4697a17a3
commit 0e59dba914
102 changed files with 3038 additions and 2764 deletions

View file

@ -40,8 +40,8 @@ class Objects extends BaseModule
$this->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() . '/' . DI::args()->getQueryString();
$nurl = Strings::normaliseLink($url);
$url = DI::baseUrl() . '/' . DI::args()->getQueryString();
$nurl = Strings::normaliseLink($url);
$ssl_url = str_replace('http://', 'https://', $nurl);
$itemuri = DBA::selectFirst('item-uri', ['guid', 'id'], ['uri' => [$url, $nurl, $ssl_url]]);
@ -63,7 +63,7 @@ class Objects extends BaseModule
if (!$validated) {
$requester = HTTPSignature::getSigner('', $_SERVER);
if (!empty($requester)) {
$receivers = Item::enumeratePermissions($item, false);
$receivers = Item::enumeratePermissions($item, false);
$receivers[] = $item['contact-id'];
$validated = in_array(Contact::getIdForURL($requester, $item['uid']), $receivers);
@ -96,16 +96,18 @@ class Objects extends BaseModule
$data = ['@context' => ActivityPub::CONTEXT];
$data = array_merge($data, $activity['object']);
} elseif (empty($this->parameters['activity']) || in_array($this->parameters['activity'],
} elseif (empty($this->parameters['activity']) || in_array(
$this->parameters['activity'],
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
'TentativeAccept', 'Follow', 'Add'])) {
'TentativeAccept', 'Follow', 'Add']
)) {
$data = ActivityPub\Transmitter::createCachedActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
if (!empty($this->parameters['activity']) && ($this->parameters['activity'] != 'Create')) {
$data['type'] = $this->parameters['activity'];
$data['id'] = str_replace('/Create', '/' . $this->parameters['activity'], $data['id']);
$data['id'] = str_replace('/Create', '/' . $this->parameters['activity'], $data['id']);
}
} else {
throw new HTTPException\NotFoundException();

View file

@ -60,14 +60,14 @@ class Statuses extends BaseApi
} elseif (!$uid) {
$condition = [
'author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED],
'uid' => 0, 'network' => Protocol::FEDERATED
'uid' => 0, 'network' => Protocol::FEDERATED
];
} else {
$condition = ["`author-id` = ? AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))", $id, $uid];
}
$condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request);
$params = $this->buildOrderAndLimitParams($request);
if (!$request['pinned'] && !$request['only_media']) {
if ($request['exclude_replies']) {
@ -98,7 +98,7 @@ class Statuses extends BaseApi
$statuses = [];
while ($item = Post::fetch($items)) {
try {
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$this->updateBoundaries($status, $item, $request['friendica_order']);
$statuses[] = $status;
} catch (\Throwable $th) {

View file

@ -35,15 +35,15 @@ class Directory extends BaseApi
$this->logger->info('directory', ['offset' => $request['offset'], 'limit' => $request['limit'], 'order' => $request['order'], 'local' => $request['local']]);
if ($request['local']) {
$table = 'owner-view';
$table = 'owner-view';
$condition = ['net-publish' => true];
} else {
$table = 'contact';
$table = 'contact';
$condition = ['uid' => 0, 'hidden' => false, 'network' => Protocol::FEDERATED];
}
$params = ['limit' => [$request['offset'], $request['limit']],
'order' => [($request['order'] == 'active') ? 'last-item' : 'created' => true]];
'order' => [($request['order'] == 'active') ? 'last-item' : 'created' => true]];
$accounts = [];
$contacts = DBA::select($table, ['id', 'uid'], $condition, $params);

View file

@ -57,7 +57,7 @@ class Search extends BaseApi
if (!is_array($result['accounts'])) {
// Curbing the search if we got an exact result
$request['type'] = 'accounts';
$request['type'] = 'accounts';
$result['accounts'] = [$result['accounts']];
}
}
@ -67,7 +67,7 @@ class Search extends BaseApi
if (!is_array($result['statuses'])) {
// Curbing the search if we got an exact result
$request['type'] = 'statuses';
$request['type'] = 'statuses';
$result['statuses'] = [$result['statuses']];
}
}
@ -143,9 +143,9 @@ class Search extends BaseApi
substr($q, 1), 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0];
$table = 'tag-search-view';
} else {
$q = Post\Engagement::escapeKeywords($q);
$q = Post\Engagement::escapeKeywords($q);
$condition = ["MATCH (`searchtext`) AGAINST (? IN BOOLEAN MODE) AND (NOT `restricted` OR `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `uid` = ?))", $q, $uid];
$table = SearchIndex::getSearchTable();
$table = SearchIndex::getSearchTable();
}
if (!empty($account_id)) {

View file

@ -44,7 +44,7 @@ class Home extends BaseApi
$condition = ['gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'uid' => $uid];
$condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request);
$params = $this->buildOrderAndLimitParams($request);
if ($request['local']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
@ -74,7 +74,7 @@ class Home extends BaseApi
$statuses = [];
while ($item = Post::fetch($items)) {
try {
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$this->updateBoundaries($status, $item, $request['friendica_order']);
$statuses[] = $status;
} catch (\Throwable $th) {

View file

@ -72,14 +72,14 @@ class ListTimeline extends BaseApi
$items = $this->getStatusesForGroup($uid, $request);
} elseif (substr($this->parameters['id'], 0, 8) == 'channel:') {
$items = $this->getStatusesForChannel($uid, $request);
} else{
} else {
$items = $this->getStatusesForCircle($uid, $request);
}
$statuses = [];
foreach ($items as $item) {
try {
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$this->updateBoundaries($status, $item, $request['friendica_order']);
$statuses[] = $status;
} catch (\Throwable $th) {
@ -135,7 +135,7 @@ class ListTimeline extends BaseApi
];
$condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request);
$params = $this->buildOrderAndLimitParams($request);
if ($request['only_media']) {
$condition = DBA::mergeConditions($condition, [

View file

@ -74,7 +74,7 @@ class PublicTimeline extends BaseApi
];
$condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request);
$params = $this->buildOrderAndLimitParams($request);
if ($request['local']) {
$condition = DBA::mergeConditions($condition, ['origin' => true]);
@ -108,7 +108,7 @@ class PublicTimeline extends BaseApi
$statuses = [];
while ($item = Post::fetch($items)) {
try {
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$status = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
$this->updateBoundaries($status, $item, $request['friendica_order']);
$statuses[] = $status;
} catch (\Throwable $th) {

View file

@ -51,7 +51,7 @@ class Statuses extends BaseApi
$uid = self::getCurrentUserID();
$request = $this->getRequest([
'limit' => 10, // Maximum number of results to return. Defaults to 10.
'limit' => 10, // Maximum number of results to return. Defaults to 10.
'offset' => 0, // Offset in set, Defaults to 0.
], $request);

View file

@ -287,8 +287,8 @@ class BaseApi extends BaseModule
$prev_request = $next_request = $request;
if ($asDate) {
$max_date = self::$boundaries['max'];
$min_date = self::$boundaries['min'];
$max_date = self::$boundaries['max'];
$min_date = self::$boundaries['min'];
$prev_request['min_id'] = $max_date->format(DateTimeFormat::JSON);
$next_request['max_id'] = $min_date->format(DateTimeFormat::JSON);
} else {
@ -432,48 +432,48 @@ class BaseApi extends BaseModule
// Check for throttling (maximum posts per day, week and month)
$throttle_day = DI::config()->get('system', 'throttle_limit_day');
if ($throttle_day > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60);
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
$posts_day = Post::countThread($condition);
if ($posts_day > $throttle_day) {
$this->logger->notice('Daily posting limit reached', ['uid' => $uid, 'posts' => $posts_day, 'limit' => $throttle_day]);
$error = $this->t('Too Many Requests');
$error = $this->t('Too Many Requests');
$error_description = $this->tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$this->jsonError(429, $errorobj->toArray());
}
}
$throttle_week = DI::config()->get('system', 'throttle_limit_week');
if ($throttle_week > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60 * 7);
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
$posts_week = Post::countThread($condition);
if ($posts_week > $throttle_week) {
$this->logger->notice('Weekly posting limit reached', ['uid' => $uid, 'posts' => $posts_week, 'limit' => $throttle_week]);
$error = $this->t('Too Many Requests');
$error = $this->t('Too Many Requests');
$error_description = $this->tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$this->jsonError(429, $errorobj->toArray());
}
}
$throttle_month = DI::config()->get('system', 'throttle_limit_month');
if ($throttle_month > 0) {
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
$datefrom = date(DateTimeFormat::MYSQL, time() - 24 * 60 * 60 * 30);
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
$condition = ["`gravity` = ? AND `uid` = ? AND `wall` AND `received` > ?", Item::GRAVITY_PARENT, $uid, $datefrom];
$posts_month = Post::countThread($condition);
if ($posts_month > $throttle_month) {
$this->logger->notice('Monthly posting limit reached', ['uid' => $uid, 'posts' => $posts_month, 'limit' => $throttle_month]);
$error = $this->t('Too Many Requests');
$error = $this->t('Too Many Requests');
$error_description = $this->tt('Monthly posting limit of %d post reached. The post was rejected.', 'Monthly posting limit of %d posts reached. The post was rejected.', $throttle_month);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description);
$this->jsonError(429, $errorobj->toArray());
}
}

View file

@ -47,13 +47,13 @@ class BaseSearch extends BaseModule
return '';
}
$header = '';
$header = '';
$results = new ResultList();
if (strpos($search, '@') === 0) {
$search = trim(substr($search, 1));
$type = Search::TYPE_PEOPLE;
$header = DI::l10n()->t('People Search - %s', $search);
$search = trim(substr($search, 1));
$type = Search::TYPE_PEOPLE;
$header = DI::l10n()->t('People Search - %s', $search);
} elseif (strpos($search, '!') === 0) {
$search = trim(substr($search, 1));
$type = Search::TYPE_GROUP;
@ -63,11 +63,19 @@ class BaseSearch extends BaseModule
$search = Network::convertToIdn($search);
if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
$itemsPerPage = DI::pConfig()->get(
DI::userSession()->getLocalUserId(),
'system',
'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile')
);
} else {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
$itemsPerPage = DI::pConfig()->get(
DI::userSession()->getLocalUserId(),
'system',
'itemspage_network',
DI::config()->get('system', 'itemspage_network')
);
}
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
@ -131,7 +139,8 @@ class BaseSearch extends BaseModule
'$filtered' => $filtered ? DI::l10n()->tt(
'%d result was filtered out because your node blocks the domain it is registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
'%d results were filtered out because your node blocks the domain they are registered on. You can review the list of domains your node is currently blocking in the <a href="/friendica">About page</a>.',
$filtered) : '',
$filtered
) : '',
'$contacts' => $entries,
'$paginate' => $pager->renderFull($results->getTotal()),
]);

View file

@ -31,11 +31,11 @@ use Friendica\Worker\UpdateContact;
class Contact extends BaseModule
{
const TAB_CONVERSATIONS = 1;
const TAB_POSTS = 2;
const TAB_PROFILE = 3;
const TAB_CONTACTS = 4;
const TAB_ADVANCED = 5;
const TAB_MEDIA = 6;
const TAB_POSTS = 2;
const TAB_PROFILE = 3;
const TAB_CONTACTS = 4;
const TAB_ADVANCED = 5;
const TAB_MEDIA = 6;
private static function batchActions()
{
@ -168,11 +168,11 @@ class Contact extends BaseModule
}
$search = trim($_GET['search'] ?? '');
$nets = trim($_GET['nets'] ?? '');
$rel = trim($_GET['rel'] ?? '');
$nets = trim($_GET['nets'] ?? '');
$rel = trim($_GET['rel'] ?? '');
$circle = trim($_GET['circle'] ?? '');
$accounttype = $_GET['accounttype'] ?? '';
$accounttype = $_GET['accounttype'] ?? '';
$accounttypeid = User::getAccountTypeByString($accounttype);
$page = DI::page();
@ -182,7 +182,7 @@ class Contact extends BaseModule
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput.css'));
$page->registerStylesheet(Theme::getPathForFile('js/friendica-tagsinput/friendica-tagsinput-typeahead.css'));
$vcard_widget = '';
$vcard_widget = '';
$findpeople_widget = Widget::findPeople();
if (isset($_GET['add'])) {
$follow_widget = Widget::follow($_GET['add']);
@ -248,10 +248,10 @@ class Contact extends BaseModule
$sql_values[] = $accounttypeid;
}
$searching = false;
$searching = false;
$search_hdr = null;
if ($search) {
$searching = true;
$searching = true;
$search_hdr = $search;
$search_txt = preg_quote(trim($search, ' @!'));
$sql_extra .= " AND (`name` REGEXP ? OR `url` REGEXP ? OR `nick` REGEXP ? OR `addr` REGEXP ? OR `alias` REGEXP ?)";
@ -313,80 +313,80 @@ class Contact extends BaseModule
$stmt = DBA::select('contact', [], $condition, ['order' => ['name'], 'limit' => [$pager->getStart(), $pager->getItemsPerPage()]]);
while ($contact = DBA::fetch($stmt)) {
$contact['blocked'] = Model\Contact\User::isBlocked($contact['id'], DI::userSession()->getLocalUserId());
$contact['blocked'] = Model\Contact\User::isBlocked($contact['id'], DI::userSession()->getLocalUserId());
$contact['readonly'] = Model\Contact\User::isIgnored($contact['id'], DI::userSession()->getLocalUserId());
$contacts[] = self::getContactTemplateVars($contact);
$contacts[] = self::getContactTemplateVars($contact);
}
DBA::close($stmt);
$tabs = [
[
'label' => DI::l10n()->t('All Contacts'),
'url' => 'contact',
'sel' => !$type ? 'active' : '',
'title' => DI::l10n()->t('Show all contacts'),
'id' => 'showall-tab',
'label' => DI::l10n()->t('All Contacts'),
'url' => 'contact',
'sel' => !$type ? 'active' : '',
'title' => DI::l10n()->t('Show all contacts'),
'id' => 'showall-tab',
'accesskey' => 'l',
],
[
'label' => DI::l10n()->t('Pending'),
'url' => 'contact/pending',
'sel' => $type == 'pending' ? 'active' : '',
'title' => DI::l10n()->t('Only show pending contacts'),
'id' => 'showpending-tab',
'label' => DI::l10n()->t('Pending'),
'url' => 'contact/pending',
'sel' => $type == 'pending' ? 'active' : '',
'title' => DI::l10n()->t('Only show pending contacts'),
'id' => 'showpending-tab',
'accesskey' => 'p',
],
[
'label' => DI::l10n()->t('Blocked'),
'url' => 'contact/blocked',
'sel' => $type == 'blocked' ? 'active' : '',
'title' => DI::l10n()->t('Only show blocked contacts'),
'id' => 'showblocked-tab',
'label' => DI::l10n()->t('Blocked'),
'url' => 'contact/blocked',
'sel' => $type == 'blocked' ? 'active' : '',
'title' => DI::l10n()->t('Only show blocked contacts'),
'id' => 'showblocked-tab',
'accesskey' => 'b',
],
[
'label' => DI::l10n()->t('Ignored'),
'url' => 'contact/ignored',
'sel' => $type == 'ignored' ? 'active' : '',
'title' => DI::l10n()->t('Only show ignored contacts'),
'id' => 'showignored-tab',
'label' => DI::l10n()->t('Ignored'),
'url' => 'contact/ignored',
'sel' => $type == 'ignored' ? 'active' : '',
'title' => DI::l10n()->t('Only show ignored contacts'),
'id' => 'showignored-tab',
'accesskey' => 'i',
],
[
'label' => DI::l10n()->t('Collapsed'),
'url' => 'contact/collapsed',
'sel' => $type == 'collapsed' ? 'active' : '',
'title' => DI::l10n()->t('Only show collapsed contacts'),
'id' => 'showcollapsed-tab',
'label' => DI::l10n()->t('Collapsed'),
'url' => 'contact/collapsed',
'sel' => $type == 'collapsed' ? 'active' : '',
'title' => DI::l10n()->t('Only show collapsed contacts'),
'id' => 'showcollapsed-tab',
'accesskey' => 'c',
],
[
'label' => DI::l10n()->t('Archived'),
'url' => 'contact/archived',
'sel' => $type == 'archived' ? 'active' : '',
'title' => DI::l10n()->t('Only show archived contacts'),
'id' => 'showarchived-tab',
'label' => DI::l10n()->t('Archived'),
'url' => 'contact/archived',
'sel' => $type == 'archived' ? 'active' : '',
'title' => DI::l10n()->t('Only show archived contacts'),
'id' => 'showarchived-tab',
'accesskey' => 'y',
],
[
'label' => DI::l10n()->t('Hidden'),
'url' => 'contact/hidden',
'sel' => $type == 'hidden' ? 'active' : '',
'title' => DI::l10n()->t('Only show hidden contacts'),
'id' => 'showhidden-tab',
'label' => DI::l10n()->t('Hidden'),
'url' => 'contact/hidden',
'sel' => $type == 'hidden' ? 'active' : '',
'title' => DI::l10n()->t('Only show hidden contacts'),
'id' => 'showhidden-tab',
'accesskey' => 'h',
],
[
'label' => DI::l10n()->t('Circles'),
'url' => 'circle',
'sel' => '',
'title' => DI::l10n()->t('Organize your contact circles'),
'id' => 'contactcircles-tab',
'label' => DI::l10n()->t('Circles'),
'url' => 'circle',
'sel' => '',
'title' => DI::l10n()->t('Organize your contact circles'),
'id' => 'contactcircles-tab',
'accesskey' => 'e',
],
];
$tabs_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
$tabs_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
$tabs_html = Renderer::replaceMacros($tabs_tpl, ['$tabs' => $tabs]);
switch ($rel) {
@ -431,26 +431,26 @@ class Contact extends BaseModule
$tpl = Renderer::getMarkupTemplate('contacts-template.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$header' => $header,
'$tabs' => $tabs_html,
'$total' => $total,
'$search' => $search_hdr,
'$desc' => DI::l10n()->t('Search your contacts'),
'$finding' => $searching ? DI::l10n()->t('Results for: %s', $search) : '',
'$submit' => DI::l10n()->t('Find'),
'$cmd' => DI::args()->getCommand(),
'$parameter' => http_build_query($request),
'$contacts' => $contacts,
'$form_security_token' => BaseModule::getFormSecurityToken('contact_batch_actions'),
'multiselect' => 1,
'$batch_actions' => [
'contacts_batch_update' => DI::l10n()->t('Update'),
'contacts_batch_block' => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'),
'contacts_batch_ignore' => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'),
'contacts_batch_collapse' => DI::l10n()->t('Collapse') . '/' . DI::l10n()->t('Uncollapse'),
'$header' => $header,
'$tabs' => $tabs_html,
'$total' => $total,
'$search' => $search_hdr,
'$desc' => DI::l10n()->t('Search your contacts'),
'$finding' => $searching ? DI::l10n()->t('Results for: %s', $search) : '',
'$submit' => DI::l10n()->t('Find'),
'$cmd' => DI::args()->getCommand(),
'$parameter' => http_build_query($request),
'$contacts' => $contacts,
'$form_security_token' => BaseModule::getFormSecurityToken('contact_batch_actions'),
'multiselect' => 1,
'$batch_actions' => [
'contacts_batch_update' => DI::l10n()->t('Update'),
'contacts_batch_block' => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'),
'contacts_batch_ignore' => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'),
'contacts_batch_collapse' => DI::l10n()->t('Collapse') . '/' . DI::l10n()->t('Uncollapse'),
],
'$h_batch_actions' => DI::l10n()->t('Batch Actions'),
'$paginate' => $pager->renderFull($total),
'$paginate' => $pager->renderFull($total),
]);
return $o;
@ -470,7 +470,7 @@ class Contact extends BaseModule
*/
public static function getTabsHTML(array $contact, int $active_tab)
{
$cid = $pcid = $contact['id'];
$cid = $pcid = $contact['id'];
$data = Model\Contact::getPublicAndUserContactID($contact['id'], DI::userSession()->getLocalUserId());
if (!empty($data['user']) && ($contact['id'] == $data['public'])) {
$cid = $data['user'];
@ -481,54 +481,54 @@ class Contact extends BaseModule
// tabs
$tabs = [
[
'label' => DI::l10n()->t('Profile'),
'url' => 'contact/' . $cid,
'sel' => (($active_tab == self::TAB_PROFILE) ? 'active' : ''),
'title' => DI::l10n()->t('Profile Details'),
'id' => 'profile-tab',
'label' => DI::l10n()->t('Profile'),
'url' => 'contact/' . $cid,
'sel' => (($active_tab == self::TAB_PROFILE) ? 'active' : ''),
'title' => DI::l10n()->t('Profile Details'),
'id' => 'profile-tab',
'accesskey' => 'o',
],
[
'label' => DI::l10n()->t('Conversations'),
'url' => 'contact/' . $pcid . '/conversations',
'sel' => (($active_tab == self::TAB_CONVERSATIONS) ? 'active' : ''),
'title' => DI::l10n()->t('Conversations started by this contact'),
'id' => 'status-tab',
'label' => DI::l10n()->t('Conversations'),
'url' => 'contact/' . $pcid . '/conversations',
'sel' => (($active_tab == self::TAB_CONVERSATIONS) ? 'active' : ''),
'title' => DI::l10n()->t('Conversations started by this contact'),
'id' => 'status-tab',
'accesskey' => 'm',
],
[
'label' => DI::l10n()->t('Posts and Comments'),
'url' => 'contact/' . $pcid . '/posts',
'sel' => (($active_tab == self::TAB_POSTS) ? 'active' : ''),
'title' => DI::l10n()->t('Individual Posts and Replies'),
'id' => 'posts-tab',
'label' => DI::l10n()->t('Posts and Comments'),
'url' => 'contact/' . $pcid . '/posts',
'sel' => (($active_tab == self::TAB_POSTS) ? 'active' : ''),
'title' => DI::l10n()->t('Individual Posts and Replies'),
'id' => 'posts-tab',
'accesskey' => 'p',
],
[
'label' => DI::l10n()->t('Media'),
'url' => 'contact/' . $pcid . '/media',
'sel' => (($active_tab == self::TAB_MEDIA) ? 'active' : ''),
'title' => DI::l10n()->t('Posts containing media objects'),
'id' => 'media-tab',
'label' => DI::l10n()->t('Media'),
'url' => 'contact/' . $pcid . '/media',
'sel' => (($active_tab == self::TAB_MEDIA) ? 'active' : ''),
'title' => DI::l10n()->t('Posts containing media objects'),
'id' => 'media-tab',
'accesskey' => 'd',
],
[
'label' => DI::l10n()->t('Contacts'),
'url' => 'contact/' . $pcid . '/contacts',
'sel' => (($active_tab == self::TAB_CONTACTS) ? 'active' : ''),
'title' => DI::l10n()->t('View all known contacts'),
'id' => 'contacts-tab',
'label' => DI::l10n()->t('Contacts'),
'url' => 'contact/' . $pcid . '/contacts',
'sel' => (($active_tab == self::TAB_CONTACTS) ? 'active' : ''),
'title' => DI::l10n()->t('View all known contacts'),
'id' => 'contacts-tab',
'accesskey' => 't'
],
];
if (!empty($contact['network']) && in_array($contact['network'], [Protocol::FEED, Protocol::MAIL]) && ($cid != $pcid)) {
$tabs[] = [
'label' => DI::l10n()->t('Advanced'),
'url' => 'contact/' . $cid . '/advanced/',
'sel' => (($active_tab == self::TAB_ADVANCED) ? 'active' : ''),
'title' => DI::l10n()->t('Advanced Contact Settings'),
'id' => 'advanced-tab',
'label' => DI::l10n()->t('Advanced'),
'url' => 'contact/' . $cid . '/advanced/',
'sel' => (($active_tab == self::TAB_ADVANCED) ? 'active' : ''),
'title' => DI::l10n()->t('Advanced Contact Settings'),
'id' => 'advanced-tab',
'accesskey' => 'r'
];
}
@ -566,11 +566,11 @@ class Contact extends BaseModule
$alt_text = DI::l10n()->t('Mutual Friendship');
break;
case Model\Contact::FOLLOWER;
case Model\Contact::FOLLOWER:
$alt_text = DI::l10n()->t('is a fan of yours');
break;
case Model\Contact::SHARING;
case Model\Contact::SHARING:
$alt_text = DI::l10n()->t('you are a fan of');
break;

View file

@ -57,7 +57,8 @@ class Token extends BaseApi
if (empty($request['client_id']) || empty($request['client_secret'])) {
$this->logger->warning('Incomplete request data', ['request' => $request]);
$this->logAndJsonError(401, $this->errorFactory->Unauthorized('invalid_client', $this->t('Incomplete request data')));;
$this->logAndJsonError(401, $this->errorFactory->Unauthorized('invalid_client', $this->t('Incomplete request data')));
;
}
$application = OAuth::getApplication($request['client_id'], $request['client_secret'], $request['redirect_uri']);
@ -90,8 +91,8 @@ class Token extends BaseApi
// now check for $grant_type === 'authorization_code'
// For security reasons only allow freshly created tokens
$redirect_uri = strtok($request['redirect_uri'],'?');
$condition = [
$redirect_uri = strtok($request['redirect_uri'], '?');
$condition = [
"`redirect_uri` LIKE ? AND `id` = ? AND `code` = ? AND `created_at` > ?",
$redirect_uri, $application['id'], $request['code'], DateTimeFormat::utc('now - 5 minutes')
];

View file

@ -62,7 +62,7 @@ class Owa extends BaseModule
$this->logger->debug('OWA header', ['addr' => $contact['addr'], 'data' => $verified]);
$ret['success'] = true;
$token = Strings::getRandomHex(32);
$token = Strings::getRandomHex(32);
// Store the generated token in the database.
OpenWebAuthToken::create('owt', 0, $token, $contact['addr']);

View file

@ -63,19 +63,19 @@ class Photo extends BaseApi
OpenWebAuth::addVisitorCookieForHTTPSigner($this->server);
$customsize = 0;
$customsize = 0;
$square_resize = true;
$scale = null;
$stamp = microtime(true);
$scale = null;
$stamp = microtime(true);
// User avatar
if (!empty($this->parameters['type'])) {
if (!empty($this->parameters['customsize'])) {
$customsize = intval($this->parameters['customsize']);
$customsize = intval($this->parameters['customsize']);
$square_resize = !in_array($this->parameters['type'], ['media', 'preview']);
}
if (!empty($this->parameters['guid'])) {
$guid = $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();
@ -90,7 +90,7 @@ class Photo extends BaseApi
if (!empty($this->parameters['nickname_ext'])) {
$nickname = pathinfo($this->parameters['nickname_ext'], PATHINFO_FILENAME);
$user = User::getByNickname($nickname, ['uid']);
$user = User::getByNickname($nickname, ['uid']);
if (empty($user)) {
throw new HTTPException\NotFoundException();
}
@ -110,9 +110,9 @@ class Photo extends BaseApi
$photo = $this->getPhotoById($id, $this->parameters['type'], $customsize ?: Proxy::PIXEL_SMALL);
} else {
$photoid = pathinfo($this->parameters['name'], PATHINFO_FILENAME);
$scale = 0;
$scale = 0;
if (substr($photoid, -2, 1) == '-') {
$scale = intval(substr($photoid, -1, 1));
$scale = intval(substr($photoid, -1, 1));
$photoid = substr($photoid, 0, -2);
}
@ -174,7 +174,7 @@ class Photo extends BaseApi
$this->logger->warning('Invalid photo', ['id' => $photo['id']]);
if (in_array($photo['backend-class'], [ExternalResource::NAME])) {
$reference = json_decode($photo['backend-ref'], true);
$error = DI::l10n()->t('Invalid external resource with url %s.', $reference['url']);
$error = DI::l10n()->t('Invalid external resource with url %s.', $reference['url']);
} else {
$error = DI::l10n()->t('Invalid photo with id %s.', $photo['id']);
}
@ -228,13 +228,13 @@ class Photo extends BaseApi
$output = microtime(true) - $stamp;
$total = microtime(true) - $totalstamp;
$rest = $total - ($fetch + $data + $checksum + $output);
$rest = $total - ($fetch + $data + $checksum + $output);
if (!is_null($scale) && ($scale < 4)) {
$this->logger->debug('Performance:', [
'scale' => $scale, 'resource' => $photo['resource-id'],
'total' => number_format($total, 3), 'fetch' => number_format($fetch, 3),
'data' => number_format($data, 3), 'checksum' => number_format($checksum, 3),
'scale' => $scale, 'resource' => $photo['resource-id'],
'total' => number_format($total, 3), 'fetch' => number_format($fetch, 3),
'data' => number_format($data, 3), 'checksum' => number_format($checksum, 3),
'output' => number_format($output, 3), 'rest' => number_format($rest, 3)
]);
}
@ -296,7 +296,7 @@ class Photo extends BaseApi
return MPhoto::createPhotoForExternalResource($link['url'], (int)DI::userSession()->getLocalUserId(), $link['mimetype'] ?? '', $link['blurhash'] ?? '', $link['width'] ?? 0, $link['height'] ?? 0);
case 'contact':
$fields = ['uid', 'uri-id', 'url', 'nurl', 'avatar', 'photo', 'blurhash', 'xmpp', 'addr', 'network', 'failed', 'updated'];
$fields = ['uid', 'uri-id', 'url', 'nurl', 'avatar', 'photo', 'blurhash', 'xmpp', 'addr', 'network', 'failed', 'updated'];
$contact = Contact::getById($id, $fields);
if (empty($contact)) {
return false;
@ -357,7 +357,7 @@ class Photo extends BaseApi
&& ((time() - strtotime($contact['updated']) > 86400));
if ($update) {
$curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::IMAGE, HttpClientOptions::REQUEST => HttpClientRequest::CONTENTTYPE]);
$update = !$curlResult->isSuccess() && ($curlResult->getReturnCode() == 404);
$update = !$curlResult->isSuccess() && ($curlResult->getReturnCode() == 404);
$this->logger->debug('Got return code for avatar', ['return code' => $curlResult->getReturnCode(), 'cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
}
if ($update) {
@ -400,7 +400,7 @@ class Photo extends BaseApi
}
return MPhoto::createPhotoForExternalResource($url, 0, $mimetext, $contact['blurhash'] ?? null, $customsize, $customsize);
case 'header':
$fields = ['uid', 'url', 'header', 'network', 'gsid'];
$fields = ['uid', 'url', 'header', 'network', 'gsid'];
$contact = Contact::getById($id, $fields);
if (empty($contact)) {
return false;

View file

@ -114,7 +114,7 @@ class Register extends BaseModule
if (DI::config()->get('system', 'publish_all')) {
$profile_publish = '<input type="hidden" name="profile_publish_reg" value="1" />';
} else {
$publish_tpl = Renderer::getMarkupTemplate('profile/publish.tpl');
$publish_tpl = Renderer::getMarkupTemplate('profile/publish.tpl');
$profile_publish = Renderer::replaceMacros($publish_tpl, [
'$instance' => 'reg',
'$pubdesc' => DI::l10n()->t('Include your profile in member directory?'),
@ -136,44 +136,44 @@ class Register extends BaseModule
$tpl = $arr['template'];
$o = Renderer::replaceMacros($tpl, [
'$invitations' => DI::config()->get('system', 'invitation_only'),
'$permonly' => self::getPolicy() === self::APPROVE,
'$permonlybox' => ['permonlybox', DI::l10n()->t('Note for the admin'), '', DI::l10n()->t('Leave a message for the admin, why you want to join this node'), DI::l10n()->t('Required')],
'$invite_desc' => DI::l10n()->t('Membership on this site is by invitation only.'),
'$invite_label' => DI::l10n()->t('Your invitation code: '),
'$invite_id' => $invite_id,
'$regtitle' => DI::l10n()->t('Registration'),
'$registertext' => BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('config', 'register_text', '')),
'$fillwith' => $fillwith,
'$fillext' => $fillext,
'$oidlabel' => $oidlabel,
'$openid' => $openid_url,
'$namelabel' => DI::l10n()->t('Your Display Name (as you would like it to be displayed on this system'),
'$addrlabel' => DI::l10n()->t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'),
'$addrlabel2' => DI::l10n()->t('Please repeat your e-mail address:'),
'$ask_password' => $ask_password,
'$password1' => ['password1', DI::l10n()->t('New Password:'), '', DI::l10n()->t('Leave empty for an auto generated password.')],
'$password2' => ['confirm', DI::l10n()->t('Confirm:'), '', ''],
'$nickdesc' => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::baseUrl()->getHost()),
'$nicklabel' => DI::l10n()->t('Choose a nickname: '),
'$photo' => $photo,
'$publish' => $profile_publish,
'$regbutt' => DI::l10n()->t('Register'),
'$username' => $username,
'$email' => $email,
'$nickname' => $nickname,
'$sitename' => DI::baseUrl()->getHost(),
'$importh' => DI::l10n()->t('Import'),
'$importt' => DI::l10n()->t('Import your profile to this friendica instance'),
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
'$tostext' => DI::l10n()->t('Terms of Service'),
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
'$privstatement'=> $this->tos->privacy_complete,
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
'$invitations' => DI::config()->get('system', 'invitation_only'),
'$permonly' => self::getPolicy() === self::APPROVE,
'$permonlybox' => ['permonlybox', DI::l10n()->t('Note for the admin'), '', DI::l10n()->t('Leave a message for the admin, why you want to join this node'), DI::l10n()->t('Required')],
'$invite_desc' => DI::l10n()->t('Membership on this site is by invitation only.'),
'$invite_label' => DI::l10n()->t('Your invitation code: '),
'$invite_id' => $invite_id,
'$regtitle' => DI::l10n()->t('Registration'),
'$registertext' => BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('config', 'register_text', '')),
'$fillwith' => $fillwith,
'$fillext' => $fillext,
'$oidlabel' => $oidlabel,
'$openid' => $openid_url,
'$namelabel' => DI::l10n()->t('Your Display Name (as you would like it to be displayed on this system'),
'$addrlabel' => DI::l10n()->t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'),
'$addrlabel2' => DI::l10n()->t('Please repeat your e-mail address:'),
'$ask_password' => $ask_password,
'$password1' => ['password1', DI::l10n()->t('New Password:'), '', DI::l10n()->t('Leave empty for an auto generated password.')],
'$password2' => ['confirm', DI::l10n()->t('Confirm:'), '', ''],
'$nickdesc' => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::baseUrl()->getHost()),
'$nicklabel' => DI::l10n()->t('Choose a nickname: '),
'$photo' => $photo,
'$publish' => $profile_publish,
'$regbutt' => DI::l10n()->t('Register'),
'$username' => $username,
'$email' => $email,
'$nickname' => $nickname,
'$sitename' => DI::baseUrl()->getHost(),
'$importh' => DI::l10n()->t('Import'),
'$importt' => DI::l10n()->t('Import your profile to this friendica instance'),
'$showtoslink' => DI::config()->get('system', 'tosdisplay'),
'$tostext' => DI::l10n()->t('Terms of Service'),
'$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
'$privstatement' => $this->tos->privacy_complete,
'$form_security_token' => BaseModule::getFormSecurityToken('register'),
'$explicit_content' => DI::config()->get('system', 'explicit_content', false),
'$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
'$additional' => !empty(DI::userSession()->getLocalUserId()),
'$parent_password' => ['parent_password', DI::l10n()->t('Parent Password:'), '', DI::l10n()->t('Please enter the password of the parent account to legitimize your request.')]
'$additional' => !empty(DI::userSession()->getLocalUserId()),
'$parent_password' => ['parent_password', DI::l10n()->t('Parent Password:'), '', DI::l10n()->t('Please enter the password of the parent account to legitimize your request.')]
]);
@ -223,12 +223,12 @@ class Register extends BaseModule
switch (self::getPolicy()) {
case self::OPEN:
$blocked = 0;
$blocked = 0;
$verified = 1;
break;
case self::APPROVE:
$blocked = 1;
$blocked = 1;
$verified = 0;
break;
@ -238,7 +238,7 @@ class Register extends BaseModule
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$blocked = 1;
$blocked = 1;
$verified = 0;
break;
}
@ -261,11 +261,11 @@ class Register extends BaseModule
DI::baseUrl()->redirect('register');
}
$blocked = 0;
$blocked = 0;
$verified = 1;
$arr['password1'] = $arr['confirm'] = $arr['parent_password'];
$arr['repeat'] = $arr['email'] = $user['email'];
$arr['repeat'] = $arr['email'] = $user['email'];
} else {
// Overwriting the "tar pit" field with the real one
$arr['email'] = $arr['field1'];
@ -280,9 +280,9 @@ class Register extends BaseModule
//Check if nickname contains only US-ASCII and do not start with a digit
if (!preg_match('/^[a-zA-Z][a-zA-Z0-9]*$/', $arr['nickname'])) {
if (is_numeric(substr($arr['nickname'], 0, 1))) {
if (is_numeric(substr($arr['nickname'], 0, 1))) {
DI::sysmsg()->addNotice(DI::l10n()->t("Nickname cannot start with a digit."));
} else {
} else {
DI::sysmsg()->addNotice(DI::l10n()->t("Nickname can only contain US-ASCII characters."));
}
$regdata = ['email' => $arr['email'], 'nickname' => $arr['nickname'], 'username' => $arr['username']];
@ -290,7 +290,7 @@ class Register extends BaseModule
return;
}
$arr['blocked'] = $blocked;
$arr['blocked'] = $blocked;
$arr['verified'] = $verified;
$arr['language'] = L10n::detectLanguage($_SERVER, $_GET, DI::config()->get('system', 'language'));
@ -318,7 +318,7 @@ class Register extends BaseModule
$using_invites = DI::config()->get('system', 'invitation_only');
$num_invites = DI::config()->get('system', 'number_invites');
$invite_id = (!empty($_POST['invite_id']) ? trim($_POST['invite_id']) : '');
$invite_id = (!empty($_POST['invite_id']) ? trim($_POST['invite_id']) : '');
if (self::getPolicy() === self::OPEN) {
if ($using_invites && $invite_id) {
@ -344,9 +344,11 @@ class Register extends BaseModule
DI::baseUrl()->redirect();
} else {
DI::sysmsg()->addNotice(
DI::l10n()->t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
DI::l10n()->t(
'Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
$user['email'],
$result['password'])
$result['password']
)
);
}
} else {
@ -422,7 +424,7 @@ class Register extends BaseModule
public static function getPolicy(): int
{
$admins = User::getAdminList(['login_date']);
$days = DI::config()->get('system', 'admin_inactivity_limit');
$days = DI::config()->get('system', 'admin_inactivity_limit');
if ($days == 0 || empty($admins)) {
return intval(DI::config()->get('config', 'register_policy'));
}

View file

@ -59,12 +59,14 @@ class Index extends BaseSearch
// 10 requests are "free", after the 11th only a call per minute is allowed
$free_crawls = intval(DI::config()->get('system', 'free_crawls'));
if ($free_crawls == 0)
if ($free_crawls == 0) {
$free_crawls = 10;
}
$crawl_permit_period = intval(DI::config()->get('system', 'crawl_permit_period'));
if ($crawl_permit_period == 0)
if ($crawl_permit_period == 0) {
$crawl_permit_period = 10;
}
$remote = $this->remoteAddress;
$result = DI::cache()->get('remote_search:' . $remote);
@ -87,16 +89,16 @@ class Index extends BaseSearch
$tag = false;
if (!empty($_GET['tag'])) {
$tag = true;
$tag = true;
$search = '#' . trim(rawurldecode($_GET['tag']));
}
// construct a wrapper for the search header
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('content_wrapper.tpl'), [
'name' => 'search-header',
'$title' => DI::l10n()->t('Search'),
'name' => 'search-header',
'$title' => DI::l10n()->t('Search'),
'$title_size' => 3,
'$content' => HTML::search($search, 'search-box', false)
'$content' => HTML::search($search, 'search-box', false)
]);
if (!$search) {
@ -104,7 +106,7 @@ class Index extends BaseSearch
}
if (strpos($search, '#') === 0) {
$tag = true;
$tag = true;
$search = substr($search, 1);
} else {
if (strpos($search, '@') === 0 || strpos($search, '!') === 0) {
@ -146,11 +148,19 @@ class Index extends BaseSearch
// No items will be shown if the member has a blocked profile wall.
if (DI::mode()->isMobile()) {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile'));
$itemsPerPage = DI::pConfig()->get(
DI::userSession()->getLocalUserId(),
'system',
'itemspage_mobile_network',
DI::config()->get('system', 'itemspage_network_mobile')
);
} else {
$itemsPerPage = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'itemspage_network',
DI::config()->get('system', 'itemspage_network'));
$itemsPerPage = DI::pConfig()->get(
DI::userSession()->getLocalUserId(),
'system',
'itemspage_network',
DI::config()->get('system', 'itemspage_network')
);
}
$last_uriid = isset($_GET['last_uriid']) ? intval($_GET['last_uriid']) : 0;
@ -160,18 +170,18 @@ class Index extends BaseSearch
if ($tag) {
$this->logger->info('Start tag search.', ['q' => $search, 'start' => $pager->getStart(), 'items' => $pager->getItemsPerPage(), 'last' => $last_uriid]);
$uriids = Tag::getURIIdListByTag($search, DI::userSession()->getLocalUserId(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
$count = Tag::countByTag($search, DI::userSession()->getLocalUserId());
$count = Tag::countByTag($search, DI::userSession()->getLocalUserId());
} else {
$this->logger->info('Start fulltext search.', ['q' => $search]);
$uriids = Post\Content::getURIIdListBySearch($search, DI::userSession()->getLocalUserId(), $pager->getStart(), $pager->getItemsPerPage(), $last_uriid);
$count = Post\Content::countBySearch($search, DI::userSession()->getLocalUserId());
$count = Post\Content::countBySearch($search, DI::userSession()->getLocalUserId());
}
if (!empty($uriids)) {
$condition = ["(`uid` = ? OR (`uid` = ? AND NOT `global`))", 0, DI::userSession()->getLocalUserId()];
$condition = DBA::mergeConditions($condition, ['uri-id' => $uriids]);
$params = ['order' => ['uri-id' => true]];
$items = Post::toArray(Post::selectForUser(DI::userSession()->getLocalUserId(), Item::DISPLAY_FIELDLIST, $condition, $params));
$params = ['order' => ['uri-id' => true]];
$items = Post::toArray(Post::selectForUser(DI::userSession()->getLocalUserId(), Item::DISPLAY_FIELDLIST, $condition, $params));
}
if (empty($items)) {

View file

@ -32,7 +32,7 @@ class Smilies extends BaseModule
protected function content(array $request = []): string
{
$smilies = Content\Smilies::getList();
$count = count($smilies['texts'] ?? []);
$count = count($smilies['texts'] ?? []);
$tpl = Renderer::getMarkupTemplate('smilies.tpl');
return Renderer::replaceMacros($tpl, [