Merge remote-tracking branch 'upstream/develop' into no-api-post

This commit is contained in:
Michael 2022-11-23 06:28:24 +00:00
commit 25992b063a
71 changed files with 5016 additions and 4336 deletions

258
.ddev/config.yaml Normal file
View File

@ -0,0 +1,258 @@
name: my-friendica
type: php
docroot: ""
php_version: "7.3"
webserver_type: apache-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: false
additional_hostnames: []
additional_fqdns: []
database:
type: mariadb
version: "10.4"
nfs_mount_enabled: false
mutagen_enabled: false
use_dns_when_possible: true
composer_version: "1"
web_environment: []
nodejs_version: "16"
webimage_extra_packages: [php7.3-gmp]
# Key features of ddev's config.yaml:
# name: <projectname> # Name of the project, automatically provides
# http://projectname.ddev.site and https://projectname.ddev.site
# type: <projecttype> # drupal6/7/8, backdrop, typo3, wordpress, php
# docroot: <relative_path> # Relative path to the directory containing index.php.
# php_version: "7.4" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"
# You can explicitly specify the webimage but this
# is not recommended, as the images are often closely tied to ddev's' behavior,
# so this can break upgrades.
# webimage: <docker_image> # nginx/php docker image.
# database:
# type: <dbtype> # mysql, mariadb
# version: <version> # database version, like "10.3" or "8.0"
# Note that mariadb_version or mysql_version from v1.18 and earlier
# will automatically be converted to this notation with just a "ddev config --auto"
# router_http_port: <port> # Port to be used for http (defaults to port 80)
# router_https_port: <port> # Port for https (defaults to 443)
# xdebug_enabled: false # Set to true to enable xdebug and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xdebug" to enable xdebug and "ddev xdebug off" to disable it work better,
# as leaving xdebug enabled all the time is a big performance hit.
# xhprof_enabled: false # Set to true to enable xhprof and "ddev start" or "ddev restart"
# Note that for most people the commands
# "ddev xhprof" to enable xhprof and "ddev xhprof off" to disable it work better,
# as leaving xhprof enabled all the time is a big performance hit.
# webserver_type: nginx-fpm # or apache-fpm
# timezone: Europe/Berlin
# This is the timezone used in the containers and by PHP;
# it can be set to any valid timezone,
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# For example Europe/Dublin or MST7MDT
# composer_root: <relative_path>
# Relative path to the composer root directory from the project root. This is
# the directory which contains the composer.json and where all Composer related
# commands are executed.
# composer_version: "2"
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
# to use the latest major version available at the time your container is built.
# It is also possible to use each other Composer version channel. This includes:
# - 2.2 (latest Composer LTS version)
# - stable
# - preview
# - snapshot
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
# To reinstall Composer after the image was built, run "ddev debug refresh".
# nodejs_version: "16"
# change from the default system Node.js version to another supported version, like 12, 14, 17, 18.
# Note that you can use 'ddev nvm' or nvm inside the web container to provide nearly any
# Node.js version, including v6, etc.
# additional_hostnames:
# - somename
# - someothername
# would provide http and https URLs for "somename.ddev.site"
# and "someothername.ddev.site".
# additional_fqdns:
# - example.com
# - sub1.example.com
# would provide http and https URLs for "example.com" and "sub1.example.com"
# Please take care with this because it can cause great confusion.
# upload_dir: custom/upload/dir
# would set the destination path for ddev import-files to <docroot>/custom/upload/dir
# When mutagen is enabled this path is bind-mounted so that all the files
# in the upload_dir don't have to be synced into mutagen
# working_dir:
# web: /var/www/html
# db: /home
# would set the default working directory for the web and db services.
# These values specify the destination directory for ddev ssh and the
# directory in which commands passed into ddev exec are run.
# omit_containers: [db, dba, ddev-ssh-agent]
# Currently only these containers are supported. Some containers can also be
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
# the "db" container, several standard features of ddev that access the
# database container will be unusable. In the global configuration it is also
# possible to omit ddev-router, but not here.
# nfs_mount_enabled: false
# Great performance improvement but requires host configuration first.
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#nfs
# mutagen_enabled: false
# Performance improvement using mutagen asynchronous updates.
# See https://ddev.readthedocs.io/en/latest/users/install/performance/#mutagen
# fail_on_hook_fail: False
# Decide whether 'ddev start' should be interrupted by a failing hook
# host_https_port: "59002"
# The host port binding for https can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_webserver_port: "59001"
# The host port binding for the ddev-webserver can be explicitly specified. It is
# dynamic unless otherwise specified.
# This is not used by most people, most people use the *router* instead
# of the localhost port.
# host_db_port: "59002"
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
# unless explicitly specified.
# phpmyadmin_port: "8036"
# phpmyadmin_https_port: "8037"
# The PHPMyAdmin ports can be changed from the default 8036 and 8037
# host_phpmyadmin_port: "8036"
# The phpmyadmin (dba) port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be specified and bound.
# mailhog_port: "8025"
# mailhog_https_port: "8026"
# The MailHog ports can be changed from the default 8025 and 8026
# host_mailhog_port: "8025"
# The mailhog port is not normally bound on the host at all, instead being routed
# through ddev-router, but it can be bound directly to localhost if specified here.
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
# Extra Debian packages that are needed in the webimage can be added here
# dbimage_extra_packages: [telnet,netcat]
# Extra Debian packages that are needed in the dbimage can be added here
# use_dns_when_possible: true
# If the host has internet access and the domain configured can
# successfully be looked up, DNS will be used for hostname resolution
# instead of editing /etc/hosts
# Defaults to true
# project_tld: ddev.site
# The top-level domain used for project URLs
# The default "ddev.site" allows DNS lookup via a wildcard
# If you prefer you can change this to "ddev.local" to preserve
# pre-v1.9 behavior.
# ngrok_args: --basic-auth username:pass1234
# Provide extra flags to the "ngrok http" command, see
# https://ngrok.com/docs#http or run "ngrok http -h"
# disable_settings_management: false
# If true, ddev will not create CMS-specific settings files like
# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php
# In this case the user must provide all such settings.
# You can inject environment variables into the web container with:
# web_environment:
# - SOMEENV=somevalue
# - SOMEOTHERENV=someothervalue
# no_project_mount: false
# (Experimental) If true, ddev will not mount the project into the web container;
# the user is responsible for mounting it manually or via a script.
# This is to enable experimentation with alternate file mounting strategies.
# For advanced users only!
# bind_all_interfaces: false
# If true, host ports will be bound on all network interfaces,
# not just the localhost interface. This means that ports
# will be available on the local network if the host firewall
# allows it.
# default_container_timeout: 120
# The default time that ddev waits for all containers to become ready can be increased from
# the default 120. This helps in importing huge databases, for example.
#web_extra_exposed_ports:
#- name: nodejs
# container_port: 3000
# http_port: 2999
# https_port: 3000
#- name: something
# container_port: 4000
# https_port: 4000
# http_port: 3999
# Allows a set of extra ports to be exposed via ddev-router
# The port behavior on the ddev-webserver must be arranged separately, for example
# using web_extra_daemons.
# For example, with a web app on port 3000 inside the container, this config would
# expose that web app on https://<project>.ddev.site:9999 and http://<project>.ddev.site:9998
# web_extra_exposed_ports:
# - container_port: 3000
# http_port: 9998
# https_port: 9999
#web_extra_daemons:
#- name: "http-1"
# command: "/var/www/html/node_modules/.bin/http-server -p 3000"
# directory: /var/www/html
#- name: "http-2"
# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000"
# directory: /var/www/html
# override_config: false
# By default, config.*.yaml files are *merged* into the configuration
# But this means that some things can't be overridden
# For example, if you have 'nfs_mount_enabled: true'' you can't override it with a merge
# and you can't erase existing hooks or all environment variables.
# However, with "override_config: true" in a particular config.*.yaml file,
# 'nfs_mount_enabled: false' can override the existing values, and
# hooks:
# post-start: []
# or
# web_environment: []
# or
# additional_hostnames: []
# can have their intended affect. 'override_config' affects only behavior of the
# config.*.yaml file it exists in.
# Many ddev commands can be extended to run tasks before or after the
# ddev command is executed, for example "post-start", "post-import-db",
# "pre-composer", "post-composer"
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
# information on the commands that can be extended and the tasks you can define
# for them. Example:
#hooks:

7
.gitignore vendored
View File

@ -10,10 +10,9 @@ home.html
robots.txt robots.txt
#ignore local config #ignore local config
/config/local.config.php !/config/local-sample.config.php
/config/addon.config.php /config/*.config.php
/config/local.ini.php /config/*.ini.php
/config/addon.ini.php
#ignore documentation, it should be newly built #ignore documentation, it should be newly built
/doc/api /doc/api

View File

@ -9,7 +9,7 @@ Our mission is to free friends, family and colleagues from data-harvesting corpo
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), [GnuSocial](https://gnu.io/social/), [Pleroma](https://pleroma.social/), or [Hubzilla](https://hubzilla.org/), regardless where each user profile is hosted. Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), [GnuSocial](https://gnu.io/social/), [Pleroma](https://pleroma.social/), or [Hubzilla](https://hubzilla.org/), regardless where each user profile is hosted.
With Friendica, you can also fully interact with anyone on Twitter, post on Facebook and receive any content on Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide. With Friendica, you can also fully interact with anyone on Twitter and receive any content from Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide.
Join today and [get your Friendica profile!](https://dir.friendica.social/servers 'Join Friendica today!') Join today and [get your Friendica profile!](https://dir.friendica.social/servers 'Join Friendica today!')

View File

@ -1,12 +0,0 @@
<?php
// Addon configuration
// Copy this configuration file to addon.config.php and edit it if you want to configure addons, see below example for the twitter addon
return [
'twitter' => [
'consumerkey' => '1234567890',
'consumersecret' => 'ABCDEFGHIJKLMONPQRSTUVWXYZ',
],
];

View File

@ -790,10 +790,6 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('post_local', $datarray); Hook::callAll('post_local', $datarray);
Hook::callAll('post_local_end', $datarray); Hook::callAll('post_local_end', $datarray);
### mod/editpost.php
Hook::callAll('jot_tool', $jotplugins);
### src/Render/FriendicaSmartyEngine.php ### src/Render/FriendicaSmartyEngine.php
Hook::callAll("template_vars", $arr); Hook::callAll("template_vars", $arr);
@ -855,6 +851,10 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep-
Hook::callAll('lockview_content', $item); Hook::callAll('lockview_content', $item);
### src/Module/Post/Edit.php
Hook::callAll('jot_tool', $jotplugins);
### src/Module/Settings/Delegation.php ### src/Module/Settings/Delegation.php
Hook::callAll('authenticate', $addon_auth); Hook::callAll('authenticate', $addon_auth);

View File

@ -37,8 +37,8 @@ The `config` directory holds key configuration files and can have different conf
All of them have to end with `.config.php` and must not include `-sample` in their name. All of them have to end with `.config.php` and must not include `-sample` in their name.
Some examples of common known configuration files: Some examples of common known configuration files:
- `local.config.php` holds the current node custom configuration. - `local.config.php` holds the base node custom configuration.
- `addon.config.php` is optional and holds the custom configuration for specific addons. - Any other file in this folder is meant for additional configuration (e.g. for addons).
Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated. Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated.
@ -59,7 +59,7 @@ Currently, the following configurations are included:
The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release. The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
The migration is pretty straightforward: The migration is pretty straightforward:
If you had any addon-specific configuration in your `.htconfig.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values. If you had any addon-specific configuration in your `.htconfig.php`, copy `config/local-sample.config.php` to `config/addon.config.php` and move your configuration values.
Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it. Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it.
<style> <style>
@ -206,7 +206,7 @@ $lang = "value";
The legacy `config/local.ini.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release. The legacy `config/local.ini.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
The migration is pretty straightforward: The migration is pretty straightforward:
If you had any addon-specific configuration in your `config/addon.ini.php`, just copy `config/addon-sample.config.php` to `config/addon.config.php` and move your configuration values. If you had any addon-specific configuration in your `config/addon.ini.php`, copy `config/local-sample.config.php` to `config/addon.config.php` and move your configuration values.
Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `config/local.ini.php` file to check your node is working as expected before deleting it. Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `config/local.ini.php` file to check your node is working as expected before deleting it.
<table class="config"> <table class="config">
@ -278,16 +278,16 @@ key[] = value3
### Database Settings ### Database Settings
The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection. The configuration variables `database.hostname` (or `database.socket`), `database.username`, `database.password`, `database.database` and optionally `database.charset` are holding your credentials for the database connection.
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable. If you need to specify a port to access the database, you can do so by appending ":portnumber" to the `database.hostname` variable.
'database' => [ 'database' => [
'hostname' => 'your.mysqlhost.com:123456', 'hostname' => 'your.mysqlhost.com:123456',
] ]
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db: If all the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
MYSQL_HOST MYSQL_HOST or MYSQL_SOCKET
MYSQL_PORT MYSQL_PORT
MYSQL_USERNAME MYSQL_USERNAME
MYSQL_PASSWORD MYSQL_PASSWORD
@ -316,7 +316,7 @@ Enabling the admin panel for an account, and thus making the account holder admi
Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file. Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file.
If more then one account should be able to access the admin panel, separate the email addresses with a comma. If more than one account should be able to access the admin panel, separate the email addresses with a comma.
'config' => [ 'config' => [
'admin_email' => 'someone@example.com,someoneelse@example.com', 'admin_email' => 'someone@example.com,someoneelse@example.com',

View File

@ -50,7 +50,7 @@ We recommend to talk to the admin(s) of the affected friendica server. (Admins,
### How can I upload images, files, links, videos and sound files to posts? ### How can I upload images, files, links, videos and sound files to posts?
You can upload images from your computer using the [editor](help/Text_editor). You can upload images from your computer using the [editor](help/Text_editor).
An overview of all uploaded images is listed at *yourpage.com/photos/profilename*. An overview of all uploaded images is listed at *yourpage.com/profile/profilename/photos*.
On that page, you can also upload images directly and choose if your contacts will receive a message about this upload. On that page, you can also upload images directly and choose if your contacts will receive a message about this upload.
Generally, you can attach any kind of file to a post. Generally, you can attach any kind of file to a post.

View File

@ -309,10 +309,6 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('post_local', $datarray); Hook::callAll('post_local', $datarray);
Hook::callAll('post_local_end', $datarray); Hook::callAll('post_local_end', $datarray);
### mod/editpost.php
Hook::callAll('jot_tool', $jotplugins);
### src/Network/FKOAuth1.php ### src/Network/FKOAuth1.php
Hook::callAll('logged_in', $a->user); Hook::callAll('logged_in', $a->user);
@ -422,6 +418,10 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap
Hook::callAll('lockview_content', $item); Hook::callAll('lockview_content', $item);
### src/Module/Post/Edit.php
Hook::callAll('jot_tool', $jotplugins);
### src/Worker/Directory.php ### src/Worker/Directory.php
Hook::callAll('globaldir_update', $arr); Hook::callAll('globaldir_update', $arr);

View File

@ -69,7 +69,7 @@ Andere erlauben nur kostenpflichtige Zertifikate als eigenes Angebot bzw. von an
### Wie kann ich Bilder, Dateien, Links, Video und Audio in Beiträge einfügen? ### Wie kann ich Bilder, Dateien, Links, Video und Audio in Beiträge einfügen?
Bilder können direkt im [Beitragseditor](help/Text_editor) vom Computer hochgeladen werden. Bilder können direkt im [Beitragseditor](help/Text_editor) vom Computer hochgeladen werden.
Eine Übersicht aller Bilder, die auf Deinem Server liegen, findest Du unter <i>deineSeite.de/photos/profilname</i>. Eine Übersicht aller Bilder, die auf Deinem Server liegen, findest Du unter <i>deineSeite.de/profile/profilname/photos</i>.
Dort kannst Du auch direkt Bilder hochladen und festlegen, ob Deine Kontakte eine Nachricht über das neue Bild bekommen. Dort kannst Du auch direkt Bilder hochladen und festlegen, ob Deine Kontakte eine Nachricht über das neue Bild bekommen.
Alle Arten von Dateien können grundsätzlich als Anhang in Friendica hochgeladen werden. Alle Arten von Dateien können grundsätzlich als Anhang in Friendica hochgeladen werden.

View File

@ -1,166 +0,0 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Util\Crypto;
function editpost_content(App $a)
{
$o = '';
if (!DI::userSession()->getLocalUserId()) {
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
return;
}
$post_id = ((DI::args()->getArgc() > 1) ? intval(DI::args()->getArgv()[1]) : 0);
if (!$post_id) {
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return;
}
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'];
$item = Post::selectFirstForUser(DI::userSession()->getLocalUserId(), $fields, ['id' => $post_id, 'uid' => DI::userSession()->getLocalUserId()]);
if (!DBA::isResult($item)) {
DI::sysmsg()->addNotice(DI::l10n()->t('Item not found'));
return;
}
$user = User::getById(DI::userSession()->getLocalUserId());
$geotag = '';
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate("section_title.tpl"), [
'$title' => DI::l10n()->t('Edit post')
]);
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => '&nbsp;', // DI::l10n()->t('Visible to <strong>everybody</strong>'),
'$geotag' => $geotag,
'$nickname' => $a->getLoggedInUserNickname(),
'$is_mobile' => DI::mode()->isMobile(),
]);
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
$lockstate = 'lock';
} else {
$lockstate = 'unlock';
}
$jotplugins = '';
$jotnets = '';
Hook::callAll('jot_tool', $jotplugins);
$tpl = Renderer::getMarkupTemplate('jot.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$is_edit' => true,
'$return_path' => '/display/' . $item['guid'],
'$action' => 'item',
'$share' => DI::l10n()->t('Save'),
'$loading' => DI::l10n()->t('Loading...'),
'$upload' => DI::l10n()->t('Upload photo'),
'$shortupload' => DI::l10n()->t('upload photo'),
'$attach' => DI::l10n()->t('Attach file'),
'$shortattach' => DI::l10n()->t('attach file'),
'$weblink' => DI::l10n()->t('Insert web link'),
'$shortweblink' => DI::l10n()->t('web link'),
'$video' => DI::l10n()->t('Insert video link'),
'$shortvideo' => DI::l10n()->t('video link'),
'$audio' => DI::l10n()->t('Insert audio link'),
'$shortaudio' => DI::l10n()->t('audio link'),
'$setloc' => DI::l10n()->t('Set your location'),
'$shortsetloc' => DI::l10n()->t('set location'),
'$noloc' => DI::l10n()->t('Clear browser location'),
'$shortnoloc' => DI::l10n()->t('clear location'),
'$wait' => DI::l10n()->t('Please wait'),
'$permset' => DI::l10n()->t('Permission settings'),
'$wall' => $item['wall'],
'$posttype' => $item['post-type'],
'$content' => undo_post_tagging($item['body']),
'$post_id' => $post_id,
'$defloc' => $user['default-location'],
'$visitor' => 'none',
'$pvisit' => 'none',
'$emailcc' => DI::l10n()->t('CC: email addresses'),
'$public' => DI::l10n()->t('Public post'),
'$jotnets' => $jotnets,
'$title' => $item['title'],
'$placeholdertitle' => DI::l10n()->t('Set title'),
'$category' => Post\Category::getCSVByURIId($item['uri-id'], DI::userSession()->getLocalUserId(), Post\Category::CATEGORY),
'$placeholdercategory' => (Feature::isEnabled(DI::userSession()->getLocalUserId(),'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : ''),
'$emtitle' => DI::l10n()->t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)),
'$bang' => ($lockstate === 'lock' ? '!' : ''),
'$profile_uid' => $_SESSION['uid'],
'$preview' => DI::l10n()->t('Preview'),
'$jotplugins' => $jotplugins,
'$cancel' => DI::l10n()->t('Cancel'),
'$rand_num' => Crypto::randomDigits(12),
// Formatting button labels
'$edbold' => DI::l10n()->t('Bold'),
'$editalic' => DI::l10n()->t('Italic'),
'$eduline' => DI::l10n()->t('Underline'),
'$edquote' => DI::l10n()->t('Quote'),
'$edcode' => DI::l10n()->t('Code'),
'$edurl' => DI::l10n()->t('Link'),
'$edattach' => DI::l10n()->t('Link or Media'),
//jot nav tab (used in some themes)
'$message' => DI::l10n()->t('Message'),
'$browser' => DI::l10n()->t('Browser'),
'$shortpermset' => DI::l10n()->t('Permissions'),
'$compose_link_title' => DI::l10n()->t('Open Compose page'),
]);
return $o;
}
function undo_post_tagging($s) {
$matches = null;
$cnt = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $s, $matches, PREG_SET_ORDER);
if ($cnt) {
foreach ($matches as $mtch) {
if (in_array($mtch[1], ['!', '@'])) {
$contact = Contact::getByURL($mtch[2], false, ['addr']);
$mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
}
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
}
}
return $s;
}

View File

@ -284,8 +284,7 @@ function photos_post(App $a)
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]); DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1] . '/image/' . DI::args()->getArgv()[3]);
} }
DI::baseUrl()->redirect('photos/' . DI::args()->getArgv()[1]); DI::baseUrl()->redirect('profile/' . DI::args()->getArgv()[1] . '/photos');
return; // NOTREACHED
} }
} }
@ -778,7 +777,6 @@ function photos_post(App $a)
function photos_content(App $a) function photos_content(App $a)
{ {
// URLs: // URLs:
// photos/name
// photos/name/upload // photos/name/upload
// photos/name/upload/xxxxx (xxxxx is album name) // photos/name/upload/xxxxx (xxxxx is album name)
// photos/name/album/xxxxx // photos/name/album/xxxxx
@ -905,7 +903,7 @@ function photos_content(App $a)
$uploader = ''; $uploader = '';
$ret = ['post_url' => 'photos/' . $user['nickname'], $ret = ['post_url' => 'profile/' . $user['nickname'] . '/photos',
'addon_text' => $uploader, 'addon_text' => $uploader,
'default_upload' => true]; 'default_upload' => true];
@ -1522,68 +1520,4 @@ function photos_content(App $a)
return $o; return $o;
} }
// Default - show recent photos with upload link (if applicable)
//$o = '';
$total = 0;
$r = DBA::toArray(DBA::p("SELECT `resource-id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = ? AND `photo-type` = ?
$sql_extra GROUP BY `resource-id`",
$user['uid'],
Photo::DEFAULT,
));
if (DBA::isResult($r)) {
$total = count($r);
}
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 20);
$r = DBA::toArray(DBA::p("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
ANY_VALUE(`type`) AS `type`, ANY_VALUE(`album`) AS `album`, max(`scale`) AS `scale`,
ANY_VALUE(`created`) AS `created` FROM `photo`
WHERE `uid` = ? AND `photo-type` = ?
$sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT ? , ?",
$user['uid'],
Photo::DEFAULT,
$pager->getStart(),
$pager->getItemsPerPage()
));
$photos = [];
if (DBA::isResult($r)) {
// "Twist" is only used for the duepunto theme with style "slackr"
$twist = false;
foreach ($r as $rr) {
$twist = !$twist;
$ext = $phototypes[$rr['type']];
$alt_e = $rr['filename'];
$name_e = $rr['album'];
$photos[] = [
'id' => $rr['id'],
'twist' => ' ' . ($twist ? 'rotleft' : 'rotright') . rand(2,4),
'link' => 'photos/' . $user['nickname'] . '/image/' . $rr['resource-id'],
'title' => DI::l10n()->t('View Photo'),
'src' => 'photo/' . $rr['resource-id'] . '-' . ((($rr['scale']) == 6) ? 4 : $rr['scale']) . '.' . $ext,
'alt' => $alt_e,
'album' => [
'link' => 'photos/' . $user['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e,
'alt' => DI::l10n()->t('View Album'),
],
];
}
}
$tpl = Renderer::getMarkupTemplate('photos_recent.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$title' => DI::l10n()->t('Recent Photos'),
'$can_post' => $can_post,
'$upload' => [DI::l10n()->t('Upload New Photos'), 'photos/' . $user['nickname'] . '/upload'],
'$photos' => $photos,
'$paginate' => $pager->renderFull($total),
]);
return $o;
} }

View File

@ -51,8 +51,6 @@ server {
listen 443 ssl; listen 443 ssl;
server_name friendica.example.net; server_name friendica.example.net;
ssl on;
#Traditional SSL #Traditional SSL
ssl_certificate /etc/nginx/ssl/friendica.example.net.chain.pem; ssl_certificate /etc/nginx/ssl/friendica.example.net.chain.pem;
ssl_certificate_key /etc/nginx/ssl/example.net.key; ssl_certificate_key /etc/nginx/ssl/example.net.key;

View File

@ -115,76 +115,40 @@ class Page implements ArrayAccess
} }
} }
// ArrayAccess interface
/** /**
* Whether a offset exists * @inheritDoc
*
* @link https://php.net/manual/en/arrayaccess.offsetexists.php
*
* @param mixed $offset <p>
* An offset to check for.
* </p>
*
* @return boolean true on success or false on failure.
* </p>
* <p>
* The return value will be casted to boolean if non-boolean was returned.
* @since 5.0.0
*/ */
#[\ReturnTypeWillChange]
public function offsetExists($offset): bool public function offsetExists($offset): bool
{ {
return isset($this->page[$offset]); return isset($this->page[$offset]);
} }
/** /**
* Offset to retrieve * @inheritDoc
*
* @link https://php.net/manual/en/arrayaccess.offsetget.php
*
* @param mixed $offset <p>
* The offset to retrieve.
* </p>
*
* @return mixed Can return all value types.
* @since 5.0.0
*/ */
#[\ReturnTypeWillChange]
public function offsetGet($offset) public function offsetGet($offset)
{ {
return $this->page[$offset] ?? null; return $this->page[$offset] ?? null;
} }
/** /**
* Offset to set * @inheritDoc
*
* @link https://php.net/manual/en/arrayaccess.offsetset.php
*
* @param mixed $offset <p>
* The offset to assign the value to.
* </p>
* @param mixed $value <p>
* The value to set.
* </p>
*
* @return void
* @since 5.0.0
*/ */
public function offsetSet($offset, $value) #[\ReturnTypeWillChange]
public function offsetSet($offset, $value): void
{ {
$this->page[$offset] = $value; $this->page[$offset] = $value;
} }
/** /**
* Offset to unset * @inheritDoc
*
* @link https://php.net/manual/en/arrayaccess.offsetunset.php
*
* @param mixed $offset <p>
* The offset to unset.
* </p>
*
* @return void
* @since 5.0.0
*/ */
public function offsetUnset($offset) #[\ReturnTypeWillChange]
public function offsetUnset($offset): void
{ {
if (isset($this->page[$offset])) { if (isset($this->page[$offset])) {
unset($this->page[$offset]); unset($this->page[$offset]);

View File

@ -526,7 +526,7 @@ class Conversation
$live_update_div = '<div id="live-search"></div>' . "\r\n"; $live_update_div = '<div id="live-search"></div>' . "\r\n";
} }
$page_dropping = $this->session->getLocalUserId() && $this->session->getLocalUserId() == $uid; $page_dropping = $this->session->getLocalUserId() && $this->session->getLocalUserId() == $uid && $mode != 'search';
if (!$update) { if (!$update) {
$_SESSION['return_path'] = $this->args->getQueryString(); $_SESSION['return_path'] = $this->args->getQueryString();

View File

@ -361,7 +361,7 @@ class Item
if ($sparkle) { if ($sparkle) {
$status_link = $profile_link . '/status'; $status_link = $profile_link . '/status';
$photos_link = str_replace('/profile/', '/photos/', $profile_link); $photos_link = $profile_link . '/photos';
$profile_link = $profile_link . '/profile'; $profile_link = $profile_link . '/profile';
} }

View File

@ -192,7 +192,7 @@ class Nav
// user menu // user menu
$nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')]; $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
$nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')]; $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
$nav['usermenu'][] = ['photos/' . $a->getLoggedInUserNickname(), DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')]; $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/photos', DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
$nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')]; $nav['usermenu'][] = ['profile/' . $a->getLoggedInUserNickname() . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')];
$nav['usermenu'][] = ['calendar/', DI::l10n()->t('Calendar'), '', DI::l10n()->t('Your calendar')]; $nav['usermenu'][] = ['calendar/', DI::l10n()->t('Calendar'), '', DI::l10n()->t('Your calendar')];
$nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')]; $nav['usermenu'][] = ['notes/', DI::l10n()->t('Personal notes'), '', DI::l10n()->t('Your personal notes')];
@ -244,12 +244,8 @@ class Nav
} }
$gdirpath = 'directory'; $gdirpath = 'directory';
if (DI::config()->get('system', 'singleuser') && DI::config()->get('system', 'directory')) {
if (strlen(DI::config()->get('system', 'singleuser'))) { $gdirpath = Profile::zrl(DI::config()->get('system', 'directory'), true);
$gdir = DI::config()->get('system', 'directory');
if (strlen($gdir)) {
$gdirpath = Profile::zrl($gdir, true);
}
} }
if ((DI::userSession()->getLocalUserId() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) && if ((DI::userSession()->getLocalUserId() || DI::config()->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&

View File

@ -112,23 +112,22 @@ class Database
$port = 0; $port = 0;
$serveraddr = trim($this->configCache->get('database', 'hostname')); $serveraddr = trim($this->configCache->get('database', 'hostname'));
$serverdata = explode(':', $serveraddr); $serverdata = explode(':', $serveraddr);
$server = $serverdata[0]; $host = trim($serverdata[0]);
if (count($serverdata) > 1) { if (count($serverdata) > 1) {
$port = trim($serverdata[1]); $port = trim($serverdata[1]);
} }
if (!empty(trim($this->configCache->get('database', 'port')))) { if (trim($this->configCache->get('database', 'port') ?? 0)) {
$port = trim($this->configCache->get('database', 'port')); $port = trim($this->configCache->get('database', 'port') ?? 0);
} }
$server = trim($server);
$user = trim($this->configCache->get('database', 'username')); $user = trim($this->configCache->get('database', 'username'));
$pass = trim($this->configCache->get('database', 'password')); $pass = trim($this->configCache->get('database', 'password'));
$db = trim($this->configCache->get('database', 'database')); $database = trim($this->configCache->get('database', 'database'));
$charset = trim($this->configCache->get('database', 'charset')); $charset = trim($this->configCache->get('database', 'charset'));
$socket = trim($this->configCache->get('database', 'socket')); $socket = trim($this->configCache->get('database', 'socket'));
if (!(strlen($server) && strlen($user))) { if (!$host && !$socket || !$user) {
return false; return false;
} }
@ -138,19 +137,20 @@ class Database
if (!$this->configCache->get('database', 'disable_pdo') && class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) { if (!$this->configCache->get('database', 'disable_pdo') && class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
$this->driver = self::PDO; $this->driver = self::PDO;
$connect = "mysql:host=" . $server . ";dbname=" . $db; if ($socket) {
$connect = 'mysql:unix_socket=' . $socket;
} else {
$connect = 'mysql:host=' . $host;
if ($port > 0) { if ($port > 0) {
$connect .= ";port=" . $port; $connect .= ';port=' . $port;
}
} }
if ($charset) { if ($charset) {
$connect .= ";charset=" . $charset; $connect .= ';charset=' . $charset;
} }
if ($socket) { $connect .= ';dbname=' . $database;
$connect .= ";$unix_socket=" . $socket;
}
try { try {
$this->connection = @new PDO($connect, $user, $pass, [PDO::ATTR_PERSISTENT => $persistent]); $this->connection = @new PDO($connect, $user, $pass, [PDO::ATTR_PERSISTENT => $persistent]);
@ -165,10 +165,12 @@ class Database
if (!$this->connected && class_exists('\mysqli')) { if (!$this->connected && class_exists('\mysqli')) {
$this->driver = self::MYSQLI; $this->driver = self::MYSQLI;
if ($port > 0) { if ($socket) {
$this->connection = @new mysqli($server, $user, $pass, $db, $port); $this->connection = @new mysqli(null, $user, $pass, $database, null, $socket);
} elseif ($port > 0) {
$this->connection = @new mysqli($host, $user, $pass, $database, $port);
} else { } else {
$this->connection = @new mysqli($server, $user, $pass, $db); $this->connection = @new mysqli($host, $user, $pass, $database);
} }
if (!mysqli_connect_errno()) { if (!mysqli_connect_errno()) {
@ -177,11 +179,6 @@ class Database
if ($charset) { if ($charset) {
$this->connection->set_charset($charset); $this->connection->set_charset($charset);
} }
if ($socket) {
$this->connection->set_socket($socket);
}
} }
} }
@ -198,6 +195,7 @@ class Database
{ {
$this->testmode = $test; $this->testmode = $test;
} }
/** /**
* Sets the logger for DBA * Sets the logger for DBA
* *
@ -222,6 +220,7 @@ class Database
{ {
$this->profiler = $profiler; $this->profiler = $profiler;
} }
/** /**
* Disconnects the current database connection * Disconnects the current database connection
*/ */
@ -358,11 +357,15 @@ class Database
if ($log) { if ($log) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($this->configCache->get('system', 'db_log_index'), DateTimeFormat::utcNow() . "\t" . @file_put_contents(
$this->configCache->get('system', 'db_log_index'),
DateTimeFormat::utcNow() . "\t" .
$row['key'] . "\t" . $row['rows'] . "\t" . $row['Extra'] . "\t" . $row['key'] . "\t" . $row['rows'] . "\t" . $row['Extra'] . "\t" .
basename($backtrace[1]["file"]) . "\t" . basename($backtrace[1]["file"]) . "\t" .
$backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" . $backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" .
substr($query, 0, 4000) . "\n", FILE_APPEND); substr($query, 0, 4000) . "\n",
FILE_APPEND
);
} }
} }
} }
@ -743,10 +746,14 @@ class Database
$duration = round($duration, 3); $duration = round($duration, 3);
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($this->configCache->get('system', 'db_log'), DateTimeFormat::utcNow() . "\t" . $duration . "\t" . @file_put_contents(
$this->configCache->get('system', 'db_log'),
DateTimeFormat::utcNow() . "\t" . $duration . "\t" .
basename($backtrace[1]["file"]) . "\t" . basename($backtrace[1]["file"]) . "\t" .
$backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" . $backtrace[1]["line"] . "\t" . $backtrace[2]["function"] . "\t" .
substr($this->replaceParameters($sql, $args), 0, 4000) . "\n", FILE_APPEND); substr($this->replaceParameters($sql, $args), 0, 4000) . "\n",
FILE_APPEND
);
} }
} }
return $retval; return $retval;
@ -1438,8 +1445,7 @@ class Database
} }
} }
array_walk($fields, function(&$value, $key) use ($options) array_walk($fields, function (&$value, $key) use ($options) {
{
$field = $value; $field = $value;
$value = DBA::quoteIdentifier($field); $value = DBA::quoteIdentifier($field);

View File

@ -383,7 +383,7 @@ class APContact
// kroeg:blocks, updated // kroeg:blocks, updated
// When the photo is too large, try to shorten it by removing parts // When the photo is too large, try to shorten it by removing parts
if (strlen($apcontact['photo']) > 255) { if (strlen($apcontact['photo'] ?? '') > 255) {
$parts = parse_url($apcontact['photo']); $parts = parse_url($apcontact['photo']);
unset($parts['fragment']); unset($parts['fragment']);
$apcontact['photo'] = (string)Uri::fromParts($parts); $apcontact['photo'] = (string)Uri::fromParts($parts);

View File

@ -1158,7 +1158,7 @@ class Contact
if ($sparkle) { if ($sparkle) {
$status_link = $profile_link . '/status'; $status_link = $profile_link . '/status';
$photos_link = str_replace('/profile/', '/photos/', $profile_link); $photos_link = $profile_link . '/photos';
$profile_link = $profile_link . '/profile'; $profile_link = $profile_link . '/profile';
} }

View File

@ -337,7 +337,7 @@ class Item
* generate a resource-id and therefore aren't intimately linked to the item. * generate a resource-id and therefore aren't intimately linked to the item.
*/ */
/// @TODO: this should first check if photo is used elsewhere /// @TODO: this should first check if photo is used elsewhere
if (strlen($item['resource-id'])) { if ($item['resource-id']) {
Photo::delete(['resource-id' => $item['resource-id'], 'uid' => $item['uid']]); Photo::delete(['resource-id' => $item['resource-id'], 'uid' => $item['uid']]);
} }
@ -2714,7 +2714,7 @@ class Item
} }
$condition = ['vid' => $vids, 'deleted' => false, 'gravity' => self::GRAVITY_ACTIVITY, $condition = ['vid' => $vids, 'deleted' => false, 'gravity' => self::GRAVITY_ACTIVITY,
'author-id' => $author_id, 'uid' => $item['uid'], 'thr-parent-id' => $uri_id]; 'author-id' => $author_id, 'uid' => $uid, 'thr-parent-id' => $uri_id];
$like_item = Post::selectFirst(['id', 'guid', 'verb'], $condition); $like_item = Post::selectFirst(['id', 'guid', 'verb'], $condition);
if (DBA::isResult($like_item)) { if (DBA::isResult($like_item)) {

View File

@ -160,7 +160,7 @@ class ParsedLogIterator implements \Iterator
* @see Iterator::next() * @see Iterator::next()
* @return void * @return void
*/ */
public function next() public function next(): void
{ {
$parsed = $this->read(); $parsed = $this->read();
@ -177,7 +177,7 @@ class ParsedLogIterator implements \Iterator
* @see Iterator::rewind() * @see Iterator::rewind()
* @return void * @return void
*/ */
public function rewind() public function rewind(): void
{ {
$this->value = null; $this->value = null;
$this->reader->rewind(); $this->reader->rewind();
@ -200,9 +200,9 @@ class ParsedLogIterator implements \Iterator
* Return current iterator value * Return current iterator value
* *
* @see Iterator::current() * @see Iterator::current()
* @return ?ParsedLogLing * @return ?ParsedLogLine
*/ */
public function current() public function current(): ?ParsedLogLine
{ {
return $this->value; return $this->value;
} }

View File

@ -80,19 +80,17 @@ class Nodeinfo
$config = DI::config(); $config = DI::config();
$usage = new stdClass(); $usage = new stdClass();
$usage->users = []; $usage->users = new \stdClass;
if (!empty($config->get('system', 'nodeinfo'))) { if (!empty($config->get('system', 'nodeinfo'))) {
$usage->users = [ $usage->users->total = intval($config->get('nodeinfo', 'total_users'));
'total' => intval($config->get('nodeinfo', 'total_users')), $usage->users->activeHalfyear = intval($config->get('nodeinfo', 'active_users_halfyear'));
'activeHalfyear' => intval($config->get('nodeinfo', 'active_users_halfyear')), $usage->users->activeMonth = intval($config->get('nodeinfo', 'active_users_monthly'));
'activeMonth' => intval($config->get('nodeinfo', 'active_users_monthly'))
];
$usage->localPosts = intval($config->get('nodeinfo', 'local_posts')); $usage->localPosts = intval($config->get('nodeinfo', 'local_posts'));
$usage->localComments = intval($config->get('nodeinfo', 'local_comments')); $usage->localComments = intval($config->get('nodeinfo', 'local_comments'));
if ($version2) { if ($version2) {
$usage->users['activeWeek'] = intval($config->get('nodeinfo', 'active_users_weekly')); $usage->users->activeWeek = intval($config->get('nodeinfo', 'active_users_weekly'));
} }
} }

View File

@ -1130,8 +1130,8 @@ class Photo
$picture['height'] = $photo['height']; $picture['height'] = $photo['height'];
$picture['type'] = $photo['type']; $picture['type'] = $photo['type'];
$picture['albumpage'] = DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $resource_id; $picture['albumpage'] = DI::baseUrl() . '/photos/' . $user['nickname'] . '/image/' . $resource_id;
$picture['picture'] = DI::baseUrl() . '/photo/{$resource_id}-0.' . $image->getExt(); $picture['picture'] = DI::baseUrl() . '/photo/' . $resource_id . '-0.' . $image->getExt();
$picture['preview'] = DI::baseUrl() . '/photo/{$resource_id}-{$smallest}.' . $image->getExt(); $picture['preview'] = DI::baseUrl() . '/photo/' . $resource_id . '-' . $smallest . '.' . $image->getExt();
Logger::info('upload done', ['picture' => $picture]); Logger::info('upload done', ['picture' => $picture]);
return $picture; return $picture;
@ -1272,4 +1272,3 @@ class Photo
return $resource_id; return $resource_id;
} }
} }

View File

@ -687,7 +687,7 @@ class Media
$previews[] = $medium['preview']; $previews[] = $medium['preview'];
} }
$type = explode('/', current(explode(';', $medium['mimetype']))); $type = explode('/', explode(';', $medium['mimetype'])[0]);
if (count($type) < 2) { if (count($type) < 2) {
Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]); Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]);
$filetype = 'unkn'; $filetype = 'unkn';

View File

@ -23,6 +23,7 @@ namespace Friendica\Model;
use Friendica\Content\Pager; use Friendica\Content\Pager;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Network\HTTPException;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -113,21 +114,27 @@ class Register
} }
/** /**
* Creates a register record for approval and returns the success of the database insert * Creates a register record for approval
* Checks for the existence of the provided user id * Checks for the existence of the provided user id
* *
* @param integer $uid The ID of the user needing approval * @param integer $uid The ID of the user needing approval
* @param string $language The registration language * @param string $language The registration language
* @param string $note An additional message from the user * @param string $note An additional message from the user
* @return boolean * @return void
* @throws \Exception * @throws \OutOfBoundsException
* @throws HTTPException\InternalServerErrorException
* @throws HTTPException\NotFoundException
*/ */
public static function createForApproval(int $uid, string $language, string $note = ''): bool public static function createForApproval(int $uid, string $language, string $note = ''): void
{ {
$hash = Strings::getRandomHex(); $hash = Strings::getRandomHex();
if (!$uid) {
throw new \OutOfBoundsException("User ID can't be empty");
}
if (!User::exists($uid)) { if (!User::exists($uid)) {
return false; throw new HTTPException\NotFoundException("User ID doesn't exist");
} }
$fields = [ $fields = [
@ -139,7 +146,9 @@ class Register
'note' => $note 'note' => $note
]; ];
return DBA::insert('register', $fields); if (!DBA::insert('register', $fields)) {
throw new HTTPException\InternalServerErrorException('Unable to insert a `register` record');
}
} }
/** /**

View File

@ -65,7 +65,7 @@ class Seen extends BaseApi
DI::notify()->save($Notify); DI::notify()->save($Notify);
if ($Notify->otype === Notification\ObjectType::ITEM) { if ($Notify->otype === Notification\ObjectType::ITEM) {
$item = Post::selectFirstForUser($uid, [], ['id' => $Notify->iid, 'uid' => $uid]); $item = Post::selectFirstForUser($uid, [], ['id' => $Notify->itemId, 'uid' => $uid]);
if (DBA::isResult($item)) { if (DBA::isResult($item)) {
// we found the item, return it to the user // we found the item, return it to the user
$ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()]; $ret = [DI::twitterStatus()->createFromUriId($item['uri-id'], $item['uid'], $include_entities)->toArray()];

View File

@ -62,7 +62,7 @@ class BaseProfile extends BaseModule
], ],
[ [
'label' => DI::l10n()->t('Photos'), 'label' => DI::l10n()->t('Photos'),
'url' => DI::baseUrl() . '/photos/' . $nickname, 'url' => $baseProfileUrl . '/photos',
'sel' => $current == 'photos' ? 'active' : '', 'sel' => $current == 'photos' ? 'active' : '',
'title' => DI::l10n()->t('Photo Albums'), 'title' => DI::l10n()->t('Photo Albums'),
'id' => 'photo-tab', 'id' => 'photo-tab',
@ -78,7 +78,7 @@ class BaseProfile extends BaseModule
], ],
]; ];
// the calendar link for the full featured events calendar // the calendar link for the full-featured events calendar
if ($is_owner && $a->getThemeInfoValue('events_in_profile')) { if ($is_owner && $a->getThemeInfoValue('events_in_profile')) {
$tabs[] = [ $tabs[] = [
'label' => DI::l10n()->t('Calendar'), 'label' => DI::l10n()->t('Calendar'),

View File

@ -88,7 +88,9 @@ class Follow extends BaseModule
} }
$uid = $this->session->getLocalUserId(); $uid = $this->session->getLocalUserId();
$url = Probe::cleanURI(trim($request['url'] ?? ''));
// uri is used by the /authorize_interaction Mastodon route
$url = Probe::cleanURI(trim($request['uri'] ?? $request['url'] ?? ''));
// Issue 6874: Allow remote following from Peertube // Issue 6874: Allow remote following from Peertube
if (strpos($url, 'acct:') === 0) { if (strpos($url, 'acct:') === 0) {

View File

@ -44,23 +44,15 @@ class Hovercard extends BaseModule
throw new HTTPException\ForbiddenException(); throw new HTTPException\ForbiddenException();
} }
// If a contact is connected the url is internally changed to 'contact/redir/CID'. We need the pure url to search for /* Possible formats for relative URLs that need to be converted to the absolute contact URL:
// the contact. So we strip out the contact id from the internal url and look in the contact table for * - contact/redir/123456
// the real url (nurl) * - contact/123456/conversations
if (strpos($contact_url, 'contact/redir/') === 0) { */
$cid = intval(substr($contact_url, 6)); if (strpos($contact_url, 'contact/') === 0 && preg_match('/(\d+)/', $contact_url, $matches)) {
} elseif (strpos($contact_url, 'contact/') === 0) { $remote_contact = Contact::selectFirst(['nurl'], ['id' => $matches[1]]);
$cid = intval(substr($contact_url, 8));
}
if (!empty($cid)) {
$remote_contact = Contact::selectFirst(['nurl'], ['id' => $cid]);
$contact_url = $remote_contact['nurl'] ?? ''; $contact_url = $remote_contact['nurl'] ?? '';
} }
$contact = [];
// if it's the url containing https it should be converted to http
if (!$contact_url) { if (!$contact_url) {
throw new HTTPException\BadRequestException(); throw new HTTPException\BadRequestException();
} }

View File

@ -46,7 +46,7 @@ class Home extends BaseModule
DI::baseUrl()->redirect('network'); DI::baseUrl()->redirect('network');
} }
if (strlen($config->get('system', 'singleuser'))) { if ($config->get('system', 'singleuser')) {
DI::baseUrl()->redirect('/profile/' . $config->get('system', 'singleuser')); DI::baseUrl()->redirect('/profile/' . $config->get('system', 'singleuser'));
} }

View File

@ -136,7 +136,7 @@ class Display extends BaseModule
} }
if ($item['gravity'] != Item::GRAVITY_PARENT) { if ($item['gravity'] != Item::GRAVITY_PARENT) {
$parent = Post::selectFirstForUser($itemUid, $fields, [ $parent = Post::selectFirst($fields, [
'uid' => [0, $itemUid], 'uid' => [0, $itemUid],
'uri-id' => $item['parent-uri-id'] 'uri-id' => $item['parent-uri-id']
], ['order' => ['uid' => true]]); ], ['order' => ['uid' => true]]);
@ -249,7 +249,15 @@ class Display extends BaseModule
$item = Post::selectFirstForUser($pageUid, $fields, $condition); $item = Post::selectFirstForUser($pageUid, $fields, $condition);
if (empty($item)) { if (empty($item)) {
throw new HTTPException\NotFoundException($this->t('The requested item doesn\'t exist or has been deleted.')); $this->page['aside'] = '';
throw new HTTPException\NotFoundException($this->t('Unfortunately, the requested conversation isn\'t available to you.</p>
<p>Possible reasons include:</p>
<ul>
<li>The top-level post isn\'t visible.</li>
<li>The top-level post was deleted.</li>
<li>The node has blocked the top-level author or the author of the shared post.</li>
<li>You have ignored or blocked the top-level author or the author of the shared post.</li>
</ul><p>'));
} }
$item['uri-id'] = $item['parent-uri-id']; $item['uri-id'] = $item['parent-uri-id'];

227
src/Module/Post/Edit.php Normal file
View File

@ -0,0 +1,227 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Post;
use Friendica\App;
use Friendica\BaseModule;
use Friendica\Content\Feature;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Model\Contact;
use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Navigation\SystemMessages;
use Friendica\Network\HTTPException;
use Friendica\Util\Crypto;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
* Controller to edit a post
*/
class Edit extends BaseModule
{
/** @var IHandleUserSessions */
protected $session;
/** @var SystemMessages */
protected $sysMessages;
/** @var App\Page */
protected $page;
/** @var App\Mode */
protected $mode;
/** @var App */
protected $app;
/** @var bool */
protected $isModal = false;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IHandleUserSessions $session, SystemMessages $sysMessages, App\Page $page, App\Mode $mode, App $app, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->session = $session;
$this->sysMessages = $sysMessages;
$this->page = $page;
$this->mode = $mode;
$this->app = $app;
}
protected function content(array $request = []): string
{
$this->isModal = $request['mode'] ?? '' === 'none';
if (!$this->session->getLocalUserId()) {
$this->errorExit($this->t('Permission denied.'), HTTPException\UnauthorizedException::class);
}
$postId = $this->parameters['post_id'] ?? 0;
if (empty($postId)) {
$this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
}
$fields = [
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'
];
$item = Post::selectFirstForUser($this->session->getLocalUserId(), $fields, [
'id' => $postId,
'uid' => $this->session->getLocalUserId(),
]);
if (empty($item)) {
$this->errorExit($this->t('Post not found.'), HTTPException\BadRequestException::class);
}
$user = User::getById($this->session->getLocalUserId());
$output = Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), [
'$title' => $this->t('Edit post'),
]);
$this->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot-header.tpl'), [
'$ispublic' => '&nbsp;',
'$geotag' => '',
'$nickname' => $this->app->getLoggedInUserNickname(),
'$is_mobile' => $this->mode->isMobile(),
]);
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
$lockstate = 'lock';
} else {
$lockstate = 'unlock';
}
$jotplugins = '';
Hook::callAll('jot_tool', $jotplugins);
$output .= Renderer::replaceMacros(Renderer::getMarkupTemplate('jot.tpl'), [
'$is_edit' => true,
'$return_path' => '/display/' . $item['guid'],
'$action' => 'item',
'$share' => $this->t('Save'),
'$loading' => $this->t('Loading...'),
'$upload' => $this->t('Upload photo'),
'$shortupload' => $this->t('upload photo'),
'$attach' => $this->t('Attach file'),
'$shortattach' => $this->t('attach file'),
'$weblink' => $this->t('Insert web link'),
'$shortweblink' => $this->t('web link'),
'$video' => $this->t('Insert video link'),
'$shortvideo' => $this->t('video link'),
'$audio' => $this->t('Insert audio link'),
'$shortaudio' => $this->t('audio link'),
'$setloc' => $this->t('Set your location'),
'$shortsetloc' => $this->t('set location'),
'$noloc' => $this->t('Clear browser location'),
'$shortnoloc' => $this->t('clear location'),
'$wait' => $this->t('Please wait'),
'$permset' => $this->t('Permission settings'),
'$wall' => $item['wall'],
'$posttype' => $item['post-type'],
'$content' => $this->undoPostTagging($item['body']),
'$post_id' => $postId,
'$defloc' => $user['default-location'],
'$visitor' => 'none',
'$pvisit' => 'none',
'$emailcc' => $this->t('CC: email addresses'),
'$public' => $this->t('Public post'),
'$title' => $item['title'],
'$placeholdertitle' => $this->t('Set title'),
'$category' => Post\Category::getCSVByURIId($item['uri-id'], $this->session->getLocalUserId(), Post\Category::CATEGORY),
'$placeholdercategory' => (Feature::isEnabled($this->session->getLocalUserId(), 'categories') ? $this->t("Categories \x28comma-separated list\x29") : ''),
'$emtitle' => $this->t('Example: bob@example.com, mary@example.com'),
'$lockstate' => $lockstate,
'$acl' => '',
'$bang' => ($lockstate === 'lock' ? '!' : ''),
'$profile_uid' => $this->session->getLocalUserId(),
'$preview' => $this->t('Preview'),
'$jotplugins' => $jotplugins,
'$cancel' => $this->t('Cancel'),
'$rand_num' => Crypto::randomDigits(12),
// Formatting button labels
'$edbold' => $this->t('Bold'),
'$editalic' => $this->t('Italic'),
'$eduline' => $this->t('Underline'),
'$edquote' => $this->t('Quote'),
'$edcode' => $this->t('Code'),
'$edurl' => $this->t('Link'),
'$edattach' => $this->t('Link or Media'),
//jot nav tab (used in some themes)
'$message' => $this->t('Message'),
'$browser' => $this->t('Browser'),
'$shortpermset' => $this->t('Permissions'),
'$compose_link_title' => $this->t('Open Compose page'),
]);
return $output;
}
/**
* Removes Tags from the item-body
*
* @param string $body The item body
*
* @return string the new item body without tagging
*/
protected function undoPostTagging(string $body)
{
$matches = null;
$content = preg_match_all('/([!#@])\[url=(.*?)\](.*?)\[\/url\]/ism', $body, $matches, PREG_SET_ORDER);
if ($content) {
foreach ($matches as $match) {
if (in_array($match[1], ['!', '@'])) {
$contact = Contact::getByURL($match[2], false, ['addr']);
$match[3] = empty($contact['addr']) ? $match[2] : $contact['addr'];
}
$body = str_replace($match[0], $match[1] . $match[3], $body);
}
}
return $body;
}
/**
* Exists the current Module because of an error
*
* @param string $message The error message
* @param string $exceptionClass In case it's a modal, throw an exception instead of an redirect
*
* @return void
*/
protected function errorExit(string $message, string $exceptionClass)
{
if ($this->isModal) {
throw new $exceptionClass($message);
} else {
$this->sysMessages->addNotice($message);
$this->baseUrl->redirect();
}
}
}

View File

@ -0,0 +1,196 @@
<?php
/**
* @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Profile\Photos;
use Friendica\App;
use Friendica\Content\Pager;
use Friendica\Content\Widget;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\Database\Database;
use Friendica\Model\Contact;
use Friendica\Model\Photo;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
use Friendica\Security\Security;
use Friendica\Util\Images;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
class Index extends \Friendica\Module\BaseProfile
{
/** @var IHandleUserSessions */
private $session;
/** @var App\Page */
private $page;
/** @var IManageConfigValues */
private $config;
/** @var App */
private $app;
/** @var Database */
private $database;
public function __construct(Database $database, App $app, IManageConfigValues $config, App\Page $page, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->session = $session;
$this->page = $page;
$this->config = $config;
$this->app = $app;
$this->database = $database;
}
protected function content(array $request = []): string
{
parent::content($request);
if ($this->config->get('system', 'block_public') && !$this->session->isAuthenticated()) {
throw new HttpException\ForbiddenException($this->t('Public access denied.'));
}
$owner = User::getOwnerDataByNick($this->parameters['nickname']);
if (!isset($owner['account_removed']) || $owner['account_removed']) {
throw new HTTPException\NotFoundException($this->t('User not found.'));
}
$owner_uid = $owner['uid'];
$is_owner = $this->session->getLocalUserId() && ($this->session->getLocalUserId() == $owner_uid);
$remote_contact = false;
if ($this->session->getRemoteContactID($owner_uid)) {
$contact_id = $this->session->getRemoteContactID($owner_uid);
$contact = Contact::getContactForUser($contact_id, $owner_uid, ['blocked', 'pending']);
$remote_contact = $contact && !$contact['blocked'] && !$contact['pending'];
}
if ($owner['hidewall'] && !$is_owner && !$remote_contact) {
throw new HttpException\ForbiddenException($this->t('Access to this item is restricted.'));
}
$this->session->set('photo_return', $this->args->getCommand());
$sql_extra = Security::getPermissionsSQLByUserId($owner_uid);
$photo = $this->database->toArray($this->database->p(
"SELECT COUNT(DISTINCT `resource-id`) AS `count`
FROM `photo`
WHERE `uid` = ?
AND `photo-type` = ?
$sql_extra",
$owner['uid'],
Photo::DEFAULT,
));
$total = $photo[0]['count'];
$pager = new Pager($this->l10n, $this->args->getQueryString(), 20);
$photos = $this->database->toArray($this->database->p(
"SELECT
`resource-id`,
ANY_VALUE(`id`) AS `id`,
ANY_VALUE(`filename`) AS `filename`,
ANY_VALUE(`type`) AS `type`,
ANY_VALUE(`album`) AS `album`,
max(`scale`) AS `scale`,
ANY_VALUE(`created`) AS `created`
FROM `photo`
WHERE `uid` = ?
AND `photo-type` = ?
$sql_extra
GROUP BY `resource-id`
ORDER BY `created` DESC
LIMIT ? , ?",
$owner['uid'],
Photo::DEFAULT,
$pager->getStart(),
$pager->getItemsPerPage()
));
$phototypes = Images::supportedTypes();
$photos = array_map(function ($photo) use ($owner, $phototypes) {
return [
'id' => $photo['id'],
'link' => 'photos/' . $owner['nickname'] . '/image/' . $photo['resource-id'],
'title' => $this->t('View Photo'),
'src' => 'photo/' . $photo['resource-id'] . '-' . ((($photo['scale']) == 6) ? 4 : $photo['scale']) . '.' . $phototypes[$photo['type']],
'alt' => $photo['filename'],
'album' => [
'link' => 'photos/' . $owner['nickname'] . '/album/' . bin2hex($photo['album']),
'name' => $photo['album'],
'alt' => $this->t('View Album'),
],
];
}, $photos);
$tpl = Renderer::getMarkupTemplate('photos_head.tpl');
$this->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$ispublic' => $this->t('everybody')
]);
if ($albums = Photo::getAlbums($owner['uid'])) {
$albums = array_map(function ($album) use ($owner) {
return [
'text' => $album['album'],
'total' => $album['total'],
'url' => 'photos/' . $owner['nickname'] . '/album/' . bin2hex($album['album']),
'urlencode' => urlencode($album['album']),
'bin2hex' => bin2hex($album['album'])
];
}, $albums);
$photo_albums_widget = Renderer::replaceMacros(Renderer::getMarkupTemplate('photo_albums.tpl'), [
'$nick' => $owner['nickname'],
'$title' => $this->t('Photo Albums'),
'$recent' => $this->t('Recent Photos'),
'$albums' => $albums,
'$upload' => [$this->t('Upload New Photos'), 'photos/' . $owner['nickname'] . '/upload'],
'$can_post' => $this->session->getLocalUserId() && $owner['uid'] == $this->session->getLocalUserId(),
]);
}
$this->page['aside'] .= Widget\VCard::getHTML($owner);
if (!empty($photo_albums_widget)) {
$this->page['aside'] .= $photo_albums_widget;
}
$o = self::getTabsHTML($this->app, 'photos', $is_owner, $owner['nickname'], Profile::getByUID($owner['uid'])['hide-friends'] ?? false);
$tpl = Renderer::getMarkupTemplate('photos_recent.tpl');
$o .= Renderer::replaceMacros($tpl, [
'$title' => $this->t('Recent Photos'),
'$can_post' => $is_owner || $remote_contact && $owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY,
'$upload' => [$this->t('Upload New Photos'), 'photos/' . $owner['nickname'] . '/upload'],
'$photos' => $photos,
'$paginate' => $pager->renderFull($total),
]);
return $o;
}
}

View File

@ -353,6 +353,7 @@ class Register extends BaseModule
} }
} elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) { } elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
if (!User::getAdminEmailList()) { if (!User::getAdminEmailList()) {
$this->logger->critical('Registration policy is set to APPROVE but no admin email address has been set in config.admin_email');
DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.')); DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.'));
DI::baseUrl()->redirect(); DI::baseUrl()->redirect();
} }
@ -362,10 +363,17 @@ class Register extends BaseModule
DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.') DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.')
. DI::l10n()->t('Your registration can not be processed.')); . DI::l10n()->t('Your registration can not be processed.'));
DI::baseUrl()->redirect('register/'); $this->baseUrl->redirect('register');
} }
try {
Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']); Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
} catch (\Throwable $e) {
$this->logger->error('Unable to create a `register` record.', ['user' => $user]);
DI::sysmsg()->addNotice(DI::l10n()->t('An internal error occured.')
. DI::l10n()->t('Your registration can not be processed.'));
$this->baseUrl->redirect('register');
}
// invite system // invite system
if ($using_invites && $invite_id) { if ($using_invites && $invite_id) {

View File

@ -230,7 +230,7 @@ class Index extends BaseSettings
'$banner' => DI::l10n()->t('Edit Profile Details'), '$banner' => DI::l10n()->t('Edit Profile Details'),
'$submit' => DI::l10n()->t('Submit'), '$submit' => DI::l10n()->t('Submit'),
'$profpic' => DI::l10n()->t('Change Profile Photo'), '$profpic' => DI::l10n()->t('Change Profile Photo'),
'$profpiclink' => '/photos/' . $profile['nickname'], '$profpiclink' => '/profile/' . $profile['nickname'] . '/photos',
'$viewprof' => DI::l10n()->t('View Profile'), '$viewprof' => DI::l10n()->t('View Profile'),
'$lbl_personal_section' => DI::l10n()->t('Personal'), '$lbl_personal_section' => DI::l10n()->t('Personal'),

View File

@ -132,7 +132,7 @@ class Index extends BaseSettings
DI::l10n()->t('or'), DI::l10n()->t('or'),
($newuser) ? ($newuser) ?
'<a href="' . DI::baseUrl() . '">' . DI::l10n()->t('skip this step') . '</a>' '<a href="' . DI::baseUrl() . '">' . DI::l10n()->t('skip this step') . '</a>'
: '<a href="' . DI::baseUrl() . '/photos/' . DI::app()->getLoggedInUserNickname() . '">' : '<a href="' . DI::baseUrl() . '/profile/' . DI::app()->getLoggedInUserNickname() . '/photos">'
. DI::l10n()->t('select a photo from your photo albums') . '</a>' . DI::l10n()->t('select a photo from your photo albums') . '</a>'
), ),
]); ]);

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Response; use Friendica\Module\Response;
use Friendica\Security\TwoFactor\Model\AppSpecificPassword; use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
@ -45,9 +46,9 @@ class AppSpecific extends BaseSettings
/** @var IManagePersonalConfigValues */ /** @var IManagePersonalConfigValues */
protected $pConfig; protected $pConfig;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) public function __construct(IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{ {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig; $this->pConfig = $pConfig;

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\Response; use Friendica\Module\Response;
use Friendica\Security\TwoFactor\Model\RecoveryCode; use Friendica\Security\TwoFactor\Model\RecoveryCode;
@ -43,9 +44,9 @@ class Recovery extends BaseSettings
/** @var IManagePersonalConfigValues */ /** @var IManagePersonalConfigValues */
protected $pConfig; protected $pConfig;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) public function __construct(IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{ {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig; $this->pConfig = $pConfig;

View File

@ -25,6 +25,7 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\BaseSettings; use Friendica\Module\BaseSettings;
use Friendica\Module\Response; use Friendica\Module\Response;
@ -45,9 +46,9 @@ class Trusted extends BaseSettings
/** @var TwoFactor\Repository\TrustedBrowser */ /** @var TwoFactor\Repository\TrustedBrowser */
protected $trustedBrowserRepo; protected $trustedBrowserRepo;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, array $server, array $parameters = []) public function __construct(IManagePersonalConfigValues $pConfig, TwoFactor\Repository\TrustedBrowser $trustedBrowserRepo, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{ {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig; $this->pConfig = $pConfig;
$this->trustedBrowserRepo = $trustedBrowserRepo; $this->trustedBrowserRepo = $trustedBrowserRepo;

View File

@ -29,6 +29,7 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session\Capability\IHandleUserSessions;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\BaseSettings; use Friendica\Module\BaseSettings;
use Friendica\Module\Response; use Friendica\Module\Response;
@ -47,9 +48,9 @@ class Verify extends BaseSettings
/** @var IManagePersonalConfigValues */ /** @var IManagePersonalConfigValues */
protected $pConfig; protected $pConfig;
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManagePersonalConfigValues $pConfig, array $server, array $parameters = []) public function __construct(IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
{ {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->pConfig = $pConfig; $this->pConfig = $pConfig;

View File

@ -254,7 +254,7 @@ class HttpClient implements ICanSendHttpRequests
$urlResult = $this->resolver->resolveURL($url); $urlResult = $this->resolver->resolveURL($url);
if ($urlResult->didErrorOccur()) { if ($urlResult->didErrorOccur()) {
throw new TransferException($urlResult->getErrorMessageString(), $urlResult->getHTTPStatusCode()); throw new TransferException($urlResult->getErrorMessageString(), $urlResult->getHTTPStatusCode() ?? 0);
} }
return $urlResult->getURL(); return $urlResult->getURL();

View File

@ -44,6 +44,8 @@ class Attachment extends BaseDataTransferObject
protected $text_url; protected $text_url;
/** @var string */ /** @var string */
protected $description; protected $description;
/** @var array */
protected $meta;
/** /**
* Creates an attachment * Creates an attachment
@ -60,6 +62,21 @@ class Attachment extends BaseDataTransferObject
$this->remote_url = $remote; $this->remote_url = $remote;
$this->text_url = $this->remote_url ?? $this->url; $this->text_url = $this->remote_url ?? $this->url;
$this->description = $attachment['description']; $this->description = $attachment['description'];
if ($type === 'image') {
if ((int) $attachment['width'] > 0 && (int) $attachment['height'] > 0) {
$this->meta['original']['width'] = (int) $attachment['width'];
$this->meta['original']['height'] = (int) $attachment['height'];
$this->meta['original']['size'] = (int) $attachment['width'] . 'x' . (int) $attachment['height'];
$this->meta['original']['aspect'] = (float) ((int) $attachment['width'] / (int) $attachment['height']);
}
if ((int) $attachment['preview-width'] > 0 && (int) $attachment['preview-height'] > 0) {
$this->meta['small']['width'] = (int) $attachment['preview-width'];
$this->meta['small']['height'] = (int) $attachment['preview-height'];
$this->meta['small']['size'] = (int) $attachment['preview-width'] . 'x' . (int) $attachment['preview-height'];
$this->meta['small']['aspect'] = (float) ((int) $attachment['preview-width'] / (int) $attachment['preview-height']);
}
}
} }
/** /**

View File

@ -80,7 +80,7 @@ interface IEmail extends JsonSerializable
* *
* @return string * @return string
*/ */
function getMessage(bool $plain = false); function getMessage(bool $plain = false): string;
/** /**
* Gets the additional mail header array * Gets the additional mail header array

View File

@ -110,12 +110,12 @@ class Email implements IEmail
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getMessage(bool $plain = false) public function getMessage(bool $plain = false): string
{ {
if ($plain) { if ($plain) {
return $this->msgText; return $this->msgText;
} else { } else {
return $this->msgHtml; return $this->msgHtml ?? '';
} }
} }

View File

@ -220,7 +220,7 @@ class Post
if ($item['event-id'] != 0) { if ($item['event-id'] != 0) {
$edpost = ['calendar/event/edit/' . $item['event-id'], DI::l10n()->t('Edit')]; $edpost = ['calendar/event/edit/' . $item['event-id'], DI::l10n()->t('Edit')];
} else { } else {
$edpost = ['editpost/' . $item['id'], DI::l10n()->t('Edit')]; $edpost = [sprintf('post/%s/edit', $item['id']), DI::l10n()->t('Edit')];
} }
} }
$dropping = in_array($item['uid'], [0, DI::userSession()->getLocalUserId()]); $dropping = in_array($item['uid'], [0, DI::userSession()->getLocalUserId()]);

View File

@ -3201,7 +3201,7 @@ class Diaspora
*/ */
public static function getReshareDetails(array $item): array public static function getReshareDetails(array $item): array
{ {
$reshared = DI::contentItem()->getSharedPost($item, ['network', 'author-addr']); $reshared = DI::contentItem()->getSharedPost($item, ['guid', 'network', 'author-addr']);
if (empty($reshared)) { if (empty($reshared)) {
return []; return [];
} }
@ -3213,7 +3213,7 @@ class Diaspora
return [ return [
'root_handle' => strtolower($reshared['post']['author-addr']), 'root_handle' => strtolower($reshared['post']['author-addr']),
'root_guid' => $reshared['guid'] 'root_guid' => $reshared['post']['guid'],
]; ];
} }
@ -3638,7 +3638,7 @@ class Diaspora
Logger::info('Got relayable data ' . $type . ' for item ' . $item['guid'] . ' (' . $item['id'] . ')'); Logger::info('Got relayable data ' . $type . ' for item ' . $item['guid'] . ' (' . $item['id'] . ')');
$msg = json_decode($item['signed_text'], true); $msg = json_decode($item['signed_text'] ?? '', true);
$message = []; $message = [];
if (is_array($msg)) { if (is_array($msg)) {

View File

@ -81,7 +81,7 @@ final class FriendicaSmartyEngine extends TemplateEngine
// "middleware": inject variables into templates // "middleware": inject variables into templates
$arr = [ $arr = [
'template' => basename($this->smarty->filename), 'template' => basename($this->smarty->filename ?? ''),
'vars' => $vars 'vars' => $vars
]; ];
Hook::callAll('template_vars', $arr); Hook::callAll('template_vars', $arr);

View File

@ -336,7 +336,7 @@ class Notifier
foreach ($items as $item) { foreach ($items as $item) {
$recipients[] = $item['contact-id']; $recipients[] = $item['contact-id'];
// pull out additional tagged people to notify (if public message) // pull out additional tagged people to notify (if public message)
if ($public_message && strlen($item['inform'])) { if ($public_message && $item['inform']) {
$people = explode(',',$item['inform']); $people = explode(',',$item['inform']);
foreach ($people as $person) { foreach ($people as $person) {
if (substr($person,0,4) === 'cid:') { if (substr($person,0,4) === 'cid:') {

View File

@ -43,7 +43,7 @@ return [
'socket' => '', 'socket' => '',
// user (String) // user (String)
// Database user name. Please don't use "root". // Database username. Please don't use "root".
'username' => '', 'username' => '',
// pass (String) // pass (String)
@ -64,7 +64,7 @@ return [
'pdo_emulate_prepares' => true, 'pdo_emulate_prepares' => true,
// disable_pdo (Boolean) // disable_pdo (Boolean)
// PDO is used by default (if available). Otherwise MySQLi will be used. // PDO is used by default (if available). Otherwise, MySQLi will be used.
'disable_pdo' => false, 'disable_pdo' => false,
// persistent (Boolean) // persistent (Boolean)
@ -145,7 +145,7 @@ return [
'block_local_dir' => false, 'block_local_dir' => false,
// blocked_tags (String) // blocked_tags (String)
// Comma separated list of hash tags that shouldn't be displayed in the trending tags // Comma separated list of hashtags that shouldn't be displayed in the trending tags
'blocked_tags' => '', 'blocked_tags' => '',
// community_no_sharer (Boolean) // community_no_sharer (Boolean)
@ -153,7 +153,7 @@ return [
'community_no_sharer' => false, 'community_no_sharer' => false,
// contact_update_limit (Integer) // contact_update_limit (Integer)
// How much contacts should be checked at a time? // How many contacts should be checked at a time?
'contact_update_limit' => 100, 'contact_update_limit' => 100,
// cron_interval (Integer) // cron_interval (Integer)
@ -259,7 +259,7 @@ return [
'disable_implicit_mentions' => false, 'disable_implicit_mentions' => false,
// disable_url_validation (Boolean) // disable_url_validation (Boolean)
// Disables the DNS lookup of an URL. // Disables the DNS lookup of a URL.
'disable_url_validation' => false, 'disable_url_validation' => false,
// disable_password_exposed (Boolean) // disable_password_exposed (Boolean)
@ -300,11 +300,11 @@ return [
// groupedit_image_limit (Integer) // groupedit_image_limit (Integer)
// Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names. // Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names.
// This can alternatively be set on a per account basis in the pconfig table. // This can alternatively be set on a per-account basis in the pconfig table.
'groupedit_image_limit' => 400, 'groupedit_image_limit' => 400,
// gserver_update_limit (Integer) // gserver_update_limit (Integer)
// How much servers should be checked at a time? // How many servers should be checked at a time?
'gserver_update_limit' => 100, 'gserver_update_limit' => 100,
// hsts (Boolean) // hsts (Boolean)
@ -330,7 +330,7 @@ return [
'ipv4_resolve' => false, 'ipv4_resolve' => false,
// invitation_only (Boolean) // invitation_only (Boolean)
// If set true registration is only possible after a current member of the node has send an invitation. // If set true registration is only possible after a current member of the node has sent an invitation.
'invitation_only' => false, 'invitation_only' => false,
// itemspage_network (Integer) // itemspage_network (Integer)
@ -483,7 +483,7 @@ return [
'paranoia' => false, 'paranoia' => false,
// permit_crawling (Boolean) // permit_crawling (Boolean)
// Restricts the search for not logged in users to one search per minute. // Restricts the search for not logged-in users to one search per minute.
'permit_crawling' => false, 'permit_crawling' => false,
// pidfile (Path) // pidfile (Path)
@ -491,7 +491,7 @@ return [
'pidfile' => '', 'pidfile' => '',
// png_quality (Integer) // png_quality (Integer)
// Sets the ImageMagick compression level for PNG images. Values ranges from 0 (uncompressed) to 9 (most compressed). // Sets the ImageMagick compression level for PNG images. Values range from 0 (uncompressed) to 9 (most compressed).
'png_quality' => 8, 'png_quality' => 8,
// profiler (Boolean) // profiler (Boolean)
@ -568,11 +568,11 @@ return [
'set_creation_date' => false, 'set_creation_date' => false,
// show_global_community_hint (Boolean) // show_global_community_hint (Boolean)
// When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node. // When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive at your node.
'show_global_community_hint' => false, 'show_global_community_hint' => false,
// show_received (Boolean) // show_received (Boolean)
// Show the receive data along with the post creation date // Show the received date along with the post creation date
'show_received' => true, 'show_received' => true,
// show_received_seconds (Integer) // show_received_seconds (Integer)
@ -609,13 +609,13 @@ return [
// username_min_length (Integer) // username_min_length (Integer)
// The minimum character length a username can be. // The minimum character length a username can be.
// This length is check once the username has been trimmed and multiple spaces have been collapsed into one. // This length is checked once the username has been trimmed and multiple spaces have been collapsed into one.
// Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars. // Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.
'username_min_length' => 3, 'username_min_length' => 3,
// username_max_length (Integer) // username_max_length (Integer)
// The maximum character length a username can be. // The maximum character length a username can be.
// This length is check once the username has been trimmed and multiple spaces have been collapsed into one. // This length is checked once the username has been trimmed and multiple spaces have been collapsed into one.
// Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars. // Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.
'username_max_length' => 48, 'username_max_length' => 48,
@ -738,8 +738,7 @@ return [
'config_dir' => 'view/smarty3', 'config_dir' => 'view/smarty3',
// use_sub_dirs (Boolean) // use_sub_dirs (Boolean)
// By default the template cache is stored in several sub directories. // By default the template cache is stored in several subdirectories.
//
'use_sub_dirs' => true, 'use_sub_dirs' => true,
], ],
]; ];

View File

@ -36,6 +36,7 @@ $profileRoutes = [
'/contacts/common' => [Module\Profile\Common::class, [R::GET]], '/contacts/common' => [Module\Profile\Common::class, [R::GET]],
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]], '/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
'/media' => [Module\Profile\Media::class, [R::GET]], '/media' => [Module\Profile\Media::class, [R::GET]],
'/photos' => [Module\Profile\Photos\Index::class, [R::GET ]],
'/photos/upload' => [Module\Profile\Photos\Upload::class, [ R::POST]], '/photos/upload' => [Module\Profile\Photos\Upload::class, [ R::POST]],
'/profile' => [Module\Profile\Profile::class, [R::GET]], '/profile' => [Module\Profile\Profile::class, [R::GET]],
'/remote_follow' => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]], '/remote_follow' => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]],
@ -342,6 +343,10 @@ return [
'/acctlink' => [Module\Acctlink::class, [R::GET]], '/acctlink' => [Module\Acctlink::class, [R::GET]],
'/apps' => [Module\Apps::class, [R::GET]], '/apps' => [Module\Apps::class, [R::GET]],
'/attach/{item:\d+}' => [Module\Attach::class, [R::GET]], '/attach/{item:\d+}' => [Module\Attach::class, [R::GET]],
// Mastodon route used by Fedifind to follow people who set their Webfinger address in their Twitter bio
'/authorize_interaction' => [Module\Contact\Follow::class, [R::GET, R::POST]],
'/babel' => [Module\Debug\Babel::class, [R::GET, R::POST]], '/babel' => [Module\Debug\Babel::class, [R::GET, R::POST]],
'/debug/ap' => [Module\Debug\ActivityPubConversion::class, [R::GET, R::POST]], '/debug/ap' => [Module\Debug\ActivityPubConversion::class, [R::GET, R::POST]],
@ -549,9 +554,14 @@ return [
'/{type}/{customsize:\d+}/{nickname_ext}' => [Module\Photo::class, [R::GET]], '/{type}/{customsize:\d+}/{nickname_ext}' => [Module\Photo::class, [R::GET]],
], ],
// Kept for backwards-compatibility
// @TODO remove by version 2023.12
'/photos/{nickname}' => [Module\Profile\Photos\Index::class, [R::GET]],
'/ping' => [Module\Notifications\Ping::class, [R::GET]], '/ping' => [Module\Notifications\Ping::class, [R::GET]],
'/post' => [ '/post' => [
'/{post_id}/edit' => [Module\Post\Edit::class, [R::GET ]],
'/{post_id}/share' => [Module\Post\Share::class, [R::GET ]], '/{post_id}/share' => [Module\Post\Share::class, [R::GET ]],
'/{item_id}/tag/add' => [Module\Post\Tag\Add::class, [ R::POST]], '/{item_id}/tag/add' => [Module\Post\Tag\Add::class, [ R::POST]],
'/{item_id}/tag/remove[/{tag_name}]' => [Module\Post\Tag\Remove::class, [R::GET, R::POST]], '/{item_id}/tag/remove[/{tag_name}]' => [Module\Post\Tag\Remove::class, [R::GET, R::POST]],

View File

@ -35,6 +35,11 @@ a.btn, a.btn:hover {
text-decoration: overline; text-decoration: overline;
} }
.icon {
width: 48px;
height: 48px;
}
/* List of social Networks */ /* List of social Networks */
img.connector, img.connector-disabled { img.connector, img.connector-disabled {
height: 40px; height: 40px;

View File

@ -590,7 +590,7 @@ function liveUpdate(src) {
var orgHeight = $("section").height(); var orgHeight = $("section").height();
var udargs = ((netargs.length) ? netargs : ''); var udargs = ((netargs.length) ? '/' + netargs : '');
var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&force=' + (force ? 1 : 0) + '&item=' + update_item; var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&force=' + (force ? 1 : 0) + '&item=' + update_item;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<h1>{{$l10n.header}}</h1> <h1>{{$l10n.header}}</h1>
{{include file="contact_template.tpl" no_contacts_checkbox=True}} {{include file="contact/entry.tpl" no_contacts_checkbox=True}}
{{include file="confirm.tpl"}} {{include file="confirm.tpl"}}

View File

@ -22,7 +22,7 @@
<div id="directory-search-end"></div> <div id="directory-search-end"></div>
{{foreach $contacts as $contact}} {{foreach $contacts as $contact}}
{{include file="contact_template.tpl"}} {{include file="contact/entry.tpl"}}
{{/foreach}} {{/foreach}}
<div class="directory-end"></div> <div class="directory-end"></div>

View File

@ -1,7 +1,7 @@
<div id="exception" class="generic-page-wrapper"> <div id="exception" class="generic-page-wrapper">
<img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/> <img class="hare" src="images/friendica-404_svg_flexy-o-hare.png"/>
<h1>{{$title}}</h1> <h1>{{$title}}</h1>
<p>{{$message}}</p> <p>{{$message nofilter}}</p>
{{if $thrown}} {{if $thrown}}
<pre>{{$thrown}} <pre>{{$thrown}}
{{$stack_trace}} {{$stack_trace}}

View File

@ -2,12 +2,8 @@
<h1>{{$header}}</h1> <h1>{{$header}}</h1>
{{foreach $contacts as $contact}} {{foreach $contacts as $contact}}
{{include file="contact_template.tpl"}} {{include file="contact/entry.tpl"}}
{{/foreach}} {{/foreach}}
<div id="contact-edit-end"></div> <div id="contact-edit-end"></div>
{{$paginate nofilter}} {{$paginate nofilter}}

View File

@ -2,14 +2,14 @@
<h3>{{$title}}</h3> <h3>{{$title}}</h3>
<ul role="menubar" class="sidebar-photos-albums-ul"> <ul role="menubar" class="sidebar-photos-albums-ul">
<li role="menuitem" class="sidebar-photos-albums-li"> <li role="menuitem" class="sidebar-photos-albums-li">
<a href="{{$baseurl}}/photos/{{$nick}}" class="sidebar-photos-albums-element" title="{{$title}}">{{$recent}}</a> <a href="profile/{{$nick}}/photos" class="sidebar-photos-albums-element" title="{{$title}}">{{$recent}}</a>
</li> </li>
{{if $albums}} {{if $albums}}
{{foreach $albums as $al}} {{foreach $albums as $al}}
{{if $al.text}} {{if $al.text}}
<li role="menuitem" class="sidebar-photos-albums-li"> <li role="menuitem" class="sidebar-photos-albums-li">
<a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}" class="sidebar-photos-albums-element"> <a href="photos/{{$nick}}/album/{{$al.bin2hex}}" class="sidebar-photos-albums-element">
<span class="badge pull-right">{{$al.total}}</span>{{$al.text}} <span class="badge pull-right">{{$al.total}}</span>{{$al.text}}
</a> </a>
</li> </li>

View File

@ -3,7 +3,7 @@
<div id="photos-usage-message">{{$usage}}</div> <div id="photos-usage-message">{{$usage}}</div>
<form action="photos/{{$nickname}}" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form"> <form action="profile/{{$nickname}}/photos" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form">
<div id="photos-upload-new-wrapper"> <div id="photos-upload-new-wrapper">
<div id="photos-upload-newalbum-div"> <div id="photos-upload-newalbum-div">
<label id="photos-upload-newalbum-text" for="photos-upload-newalbum">{{$newalbum}}</label> <label id="photos-upload-newalbum-text" for="photos-upload-newalbum">{{$newalbum}}</label>
@ -47,4 +47,3 @@
<div class="photos-upload-end"></div> <div class="photos-upload-end"></div>
</form> </form>

View File

@ -10,7 +10,7 @@
{{if $contacts}} {{if $contacts}}
<div id="viewcontact_wrapper-{{$id}}"> <div id="viewcontact_wrapper-{{$id}}">
{{foreach $contacts as $contact}} {{foreach $contacts as $contact}}
{{include file="contact_template.tpl"}} {{include file="contact/entry.tpl"}}
{{/foreach}} {{/foreach}}
</div> </div>
{{else}} {{else}}

View File

@ -92,7 +92,7 @@
{{if !$additional}} {{if !$additional}}
<h3>{{$importh}}</h3> <h3>{{$importh}}</h3>
<div id ="import-profile"> <div id ="import-profile">
<a href="uimport">{{$importt}}</a> <a href="user/import">{{$importt}}</a>
</div> </div>
{{/if}} {{/if}}
</form> </form>

View File

@ -132,16 +132,16 @@ class Color {
$var_1 = 2 * $L - $var_2; $var_1 = 2 * $L - $var_2;
$r = round(255 * self::_huetorgb( $var_1, $var_2, $H + (1/3) )); $r = 255 * self::_huetorgb( $var_1, $var_2, $H + (1/3) );
$g = round(255 * self::_huetorgb( $var_1, $var_2, $H )); $g = 255 * self::_huetorgb( $var_1, $var_2, $H );
$b = round(255 * self::_huetorgb( $var_1, $var_2, $H - (1/3) )); $b = 255 * self::_huetorgb( $var_1, $var_2, $H - (1/3) );
} }
// Convert to hex // Convert to hex
$r = dechex($r); $r = dechex(round($r));
$g = dechex($g); $g = dechex(round($g));
$b = dechex($b); $b = dechex(round($b));
// Make sure we get 2 digits for decimals // Make sure we get 2 digits for decimals
$r = (strlen("".$r)===1) ? "0".$r:$r; $r = (strlen("".$r)===1) ? "0".$r:$r;

View File

@ -0,0 +1,30 @@
{{$live_update nofilter}}
{{foreach $threads as $thread}}
<div id="tread-wrapper-{{$thread.id}}" class="tread-wrapper panel toplevel_item">
{{foreach $thread.items as $item}}
{{if $item.comment_firstcollapsed}}
<div class="hide-comments-outer">
<span id="hide-comments-total-{{$thread.id}}" class="hide-comments-total">{{$thread.num_comments}}</span>
<span id="hide-comments-{{$thread.id}}" class="hide-comments fakelink" onclick="showHideComments({{$thread.id}});">{{$thread.hide_text}}</span>
</div>
<div id="collapsed-comments-{{$thread.id}}" class="collapsed-comments" style="display: none;">
{{/if}}
{{if $item.comment_lastcollapsed}}</div>{{/if}}
{{include file="{{$item.template}}"}}
{{/foreach}}
</div>
{{/foreach}}
{{if !$update}}
<div id="conversation-end"></div>
{{if $dropping}}
<div id="item-delete-selected" class="fakelink" onclick="deleteCheckedItems();">
<div id="item-delete-selected-icon" class="icon drophide" title="{{$dropping}}"
onmouseover="imgbright(this);" onmouseout="imgdull(this);"></div>
<div id="item-delete-selected-desc">{{$dropping}}</div>
</div>
<div id="item-delete-selected-end"></div>
{{/if}}
{{/if}}

View File

@ -15,14 +15,14 @@
<ul role="menubar" class="sidebar-photos-albums-ul clear"> <ul role="menubar" class="sidebar-photos-albums-ul clear">
<li role="menuitem" class="sidebar-photos-albums-li"> <li role="menuitem" class="sidebar-photos-albums-li">
<a href="{{$baseurl}}/photos/{{$nick}}" class="sidebar-photos-albums-element" title="{{$title}}">{{$recent}}</a> <a href="profile/{{$nick}}/photos" class="sidebar-photos-albums-element" title="{{$title}}">{{$recent}}</a>
</li> </li>
{{if $albums}} {{if $albums}}
{{foreach $albums as $al}} {{foreach $albums as $al}}
{{if $al.text}} {{if $al.text}}
<li role="menuitem" class="sidebar-photos-albums-li"> <li role="menuitem" class="sidebar-photos-albums-li">
<a href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}" class="sidebar-photos-albums-element"> <a href="photos/{{$nick}}/album/{{$al.bin2hex}}" class="sidebar-photos-albums-element">
<span class="badge pull-right">{{$al.total}}</span>{{$al.text}} <span class="badge pull-right">{{$al.total}}</span>{{$al.text}}
</a> </a>
</li> </li>

View File

@ -4,7 +4,7 @@
<div id="photos-usage-message">{{$usage}}</div> <div id="photos-usage-message">{{$usage}}</div>
<form action="photos/{{$nickname}}" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form"> <form action="profile/{{$nickname}}/photos" enctype="multipart/form-data" method="post" name="photos-upload-form" id="photos-upload-form">
<div id="photos-upload-div" class="form-group"> <div id="photos-upload-div" class="form-group">
<label id="photos-upload-text" for="photos-upload-newalbum">{{$newalbum}}</label> <label id="photos-upload-text" for="photos-upload-newalbum">{{$newalbum}}</label>

View File

@ -92,7 +92,7 @@
{{if !$additional}} {{if !$additional}}
<h3>{{$importh}}</h3> <h3>{{$importh}}</h3>
<div id ="import-profile"> <div id ="import-profile">
<a href="uimport">{{$importt}}</a> <a href="user/import">{{$importt}}</a>
</div> </div>
{{/if}} {{/if}}
</form> </form>

View File

@ -1,33 +1,7 @@
<!-- TODO => Unknow block --> <div id="item-{{$item.guid}}" class="item-{{$item.id}} wall-item-container panel-body{{$item.indent}} {{$item.shiny}} {{$item.previewing}}">
<div class="wall-item-decor" style="display:none;">
{{if $item.star}}<span class="icon s22 star {{$item.isstarred}}" id="starred-{{$item.id}}" title="{{$item.star.starred}}">{{$item.star.starred}}</span>{{/if}}
{{if $item.lock}}<span class="navicon lock fakelink" onclick="lockview(event, 'item', {{$item.id}});" title="{{$item.lock}}"></span><span class="fa fa-lock" aria-hidden="true"></span>{{/if}}
</div>
<!-- ./TODO => Unknow block -->
<div class="panel item-{{$item.id}}" id="item-{{$item.guid}}">
<span class="commented" style="display: none;">{{$item.commented}}</span>
<span class="received" style="display: none;">{{$item.received}}</span>
<span class="created" style="display: none;">{{$item.created_date}}</span>
<span class="uriid" style="display: none;">{{$item.uriid}}</span>
<div class="wall-item-container panel-body{{$item.indent}} {{$item.shiny}} {{$item.previewing}}">
<div class="media"> <div class="media">
{{* Put additional actions in a top-right dropdown menu *}} {{* Put additional actions in a top-right dropdown menu *}}
<div class="preferences">
{{if $item.network_icon != ""}}
<span class="wall-item-network"><i class="fa fa-{{$item.network_icon}}" title="{{$item.network_name}}" aria-hidden="true"></i></span>
{{else}}
<span class="wall-item-network" title="{{$item.app}}">{{$item.network_name}}</span>
{{/if}}
{{if $item.plink}} {{*link to the original source of the item *}}
<a href="{{$item.plink.href}}" class="plink u-url" aria-label="{{$item.plink.title}}" title="{{$item.plink.title}}">
<i class="fa fa-external-link"></i>
</a>
{{/if}}
</div>
{{* The avatar picture and the photo-menu *}} {{* The avatar picture and the photo-menu *}}
<div class="dropdown pull-left"><!-- Dropdown --> <div class="dropdown pull-left"><!-- Dropdown -->
<div class="hidden-sm hidden-xs contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}"> <div class="hidden-sm hidden-xs contact-photo-wrapper mframe{{if $item.owner_url}} wwfrom{{/if}}">
@ -49,6 +23,18 @@
{{* contact info header*}} {{* contact info header*}}
<div role="heading" class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer --> <div role="heading" class="contact-info hidden-sm hidden-xs media-body"><!-- <= For computer -->
<div class="preferences">
{{if $item.network_icon != ""}}
<span class="wall-item-network"><i class="fa fa-{{$item.network_icon}}" title="{{$item.network_name}}" aria-hidden="true"></i></span>
{{else}}
<span class="wall-item-network" title="{{$item.app}}">{{$item.network_name}}</span>
{{/if}}
{{if $item.plink}} {{*link to the original source of the item *}}
<a href="{{$item.plink.href}}" class="plink u-url" aria-label="{{$item.plink.title}}" title="{{$item.plink.title}}">
<i class="fa fa-external-link"></i>
</a>
{{/if}}
</div>
<h4 class="media-heading"> <h4 class="media-heading">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card"> <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card">
<span class="wall-item-name {{$item.sparkle}}">{{$item.name}}</span> <span class="wall-item-name {{$item.sparkle}}">{{$item.name}}</span>
@ -90,7 +76,19 @@
</div> </div>
{{* contact info header for smartphones *}} {{* contact info header for smartphones *}}
<div role="heading " class="contact-info-xs hidden-lg hidden-md"> <div role="heading" class="contact-info-xs hidden-lg hidden-md">
<div class="preferences">
{{if $item.network_icon != ""}}
<span class="wall-item-network"><i class="fa fa-{{$item.network_icon}}" title="{{$item.network_name}}" aria-hidden="true"></i></span>
{{else}}
<span class="wall-item-network" title="{{$item.app}}">{{$item.network_name}}</span>
{{/if}}
{{if $item.plink}} {{*link to the original source of the item *}}
<a href="{{$item.plink.href}}" class="plink u-url" aria-label="{{$item.plink.title}}" title="{{$item.plink.title}}">
<i class="fa fa-external-link"></i>
</a>
{{/if}}
</div>
<h5 class="media-heading"> <h5 class="media-heading">
<a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card"><span>{{$item.name}}</span></a> <a href="{{$item.profile_url}}" title="{{$item.linktitle}}" class="wall-item-name-link userinfo hover-card"><span>{{$item.name}}</span></a>
<p class="text-muted"><small> <p class="text-muted"><small>
@ -298,5 +296,4 @@
{{/if}} {{/if}}
</div> </div>
</div><!--./media>--> </div><!--./media>-->
</div><!-- ./panel-body --> </div><!-- ./panel-body -->
</div><!--./panel-->

View File

@ -179,7 +179,7 @@ function frio_contact_photo_menu(App $a, &$args)
// Add to pm link a new key with the value 'modal'. // Add to pm link a new key with the value 'modal'.
// Later we can make conditions in the corresponding templates (e.g. // Later we can make conditions in the corresponding templates (e.g.
// contact_template.tpl) // contact/entry.tpl)
if (strpos($pmlink, 'message/new/' . $cid) !== false) { if (strpos($pmlink, 'message/new/' . $cid) !== false) {
$args['menu']['pm'][3] = 'modal'; $args['menu']['pm'][3] = 'modal';
} }
@ -236,6 +236,9 @@ function frio_remote_nav(App $a, array &$nav_info)
// user menu // user menu
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')]; $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'], DI::l10n()->t('Status'), '', DI::l10n()->t('Your posts and conversations')];
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')]; $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/profile', DI::l10n()->t('Profile'), '', DI::l10n()->t('Your profile page')];
// Kept for backwards-compatibility reasons, the remote server may not have updated to version 2022.12 yet
// @TODO Switch with the new routes by version 2023.12
//$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/photos', DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
$nav_info['nav']['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')]; $nav_info['nav']['usermenu'][] = [$server_url . '/photos/' . $remoteUser['nick'], DI::l10n()->t('Photos'), '', DI::l10n()->t('Your photos')];
$nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')]; $nav_info['nav']['usermenu'][] = [$server_url . '/profile/' . $remoteUser['nick'] . '/media', DI::l10n()->t('Media'), '', DI::l10n()->t('Your postings with media')];
$nav_info['nav']['usermenu'][] = [$server_url . '/calendar/', DI::l10n()->t('Calendar'), '', DI::l10n()->t('Your calendar')]; $nav_info['nav']['usermenu'][] = [$server_url . '/calendar/', DI::l10n()->t('Calendar'), '', DI::l10n()->t('Your calendar')];

View File

@ -70,7 +70,6 @@
<div style="display: none;"> <div style="display: none;">
<div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;"> <div id="profile-jot-acl-wrapper" style="width:auto;height:auto;overflow:auto;">
{{$acl nofilter}} {{$acl nofilter}}
{{$jotnets nofilter}}
{{if $scheduled_at}}{{$scheduled_at nofilter}}{{/if}} {{if $scheduled_at}}{{$scheduled_at nofilter}}{{/if}}
{{if $created_at}}{{$created_at nofilter}}{{/if}} {{if $created_at}}{{$created_at nofilter}}{{/if}}
</div> </div>