1
1
Fork 0

Merge pull request #5155 from MrPetovan/develop

Update develop
This commit is contained in:
Tobias Diekershoff 2018-06-01 13:48:18 +02:00 committed by GitHub
commit 69300291f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
475 changed files with 75163 additions and 91303 deletions

5
.gitignore vendored
View file

@ -54,8 +54,9 @@ nbproject
#ignore things from transifex-client
venv/
#ignore all in 'vendor' as `utils/composer.phar install` will bring it back
vendor/*
#ignore Composer dependencies
/vendor
/view/asset
#ignore config files from JetBrains
/.idea

106
CHANGELOG
View file

@ -1,3 +1,105 @@
Version 2018.05 (2018-06-01)
Friendica Core:
Update to the translations (DE, EN-GB, EN-US, FI, IS, IT, NL, PL, RU, ZN CH) [translation teams]
Update to the documentation [andyhee, annando, fabrixxm, M-arcus, MrPedovan, rudloff, tobiasd]
Enhancements to the DB handling [annando]
Enhancements to the relay system [annando]
Enhancements to the handling of URL that contain unicode characters [annando]
Enhancements to the Vagrant VM configuration [fabrixxm, tobiasd]
Enhancementa to the Babel module [MrPetovan]
Enhancements to the display of the [code] elements [MrPetovan]
Enhancements to the federation (OStatus, diaspora) [annando]
Enhancements to the PHP7.2 compatibility [Alkarex, MrPetovan, Quix0r]
Enhancements to the themes (frio, vier) [astifter, fabrixxm, koyuawsmbrtn, M-arcus, MrPetovan, Quix0r, rabuzarus]
Enhancements to the accessibility using the frio theme [annando]
Enhancements to the display of the registration note and the privacy statements on the registration page [tobiasd]
Enhancements to the UI by clarification of the wording (deletion of items, network widget, invitations) [annando, tobiasd]
Enhancements to the background worker [annando]
Enhancements to the forum display in the sidebar [annando]
Enhancements to the testing system [rudloff, tobiasd]
Enhancements to the display of events [MrPetovan]
Enhancements to the language detection of postings [MrPetovan]
Enhancements to the memcached handling [MrPetovan]
Enhancements to the Dandelion app support [annando]
Enhancements to the API [rudloff]
Enhancements to the systemd timer example [ben-utzer]
Enhancements to the notification emails to better integrate the securemail addon [tobiasd]
Enhancements to the caching/loading mechanisms [MrPetovan]
Enhancements to the sample-nginx configfile to not use $uri in the rewrite rules [anmol26s]
Fixed a bug in the relocation process of a Friendica instance [annando]
Fixed a bug in the shell wrapper for the console [MrPetovan]
Fixed a bug with the console tool po2php [MrPetovan]
Fixed a bug with the console tool blockaccounts [MrPetovan]
Fixed a bug in the ACL [annando, MrPetovan]
Fixed a bug that prevented the deletion of contact groups [annando]
Fixed a bug that made edited mentions and hashtags plaintext [annando]
Fixed a bug that caused the /display page to receive constandly new updates [annando]
Fixed wrong version of a dependency preventing the usage of PHP 5.6 [MrPetovan]
Fixed a bug in OpenID authentification [Quix0r]
Fixed a bug in the item deletion [annando]
Fixed a bug that prevented public comments from being distributed [annando]
Fixed a bug that caused empty profile pictures for public contacts [annando]
Fixed a bug that prevented the display of some postings in the network stream [annando]
Fixed a bug in the display of videos with parameters [annando]
Fixed a bug that caused the display of blocked contacts under some conditions [annando]
Fixed bugs in the installer [annando, M-arcus]
Fixed a bug in the installer running on nginx [astifter]
Fixed a bug with reshares from diaspora* [annando]
Fixed a bug that accounts from diaspora* could join private forums automatically [annando]
Fixed a bug that prevented the selection of displayed profiles for other Friendica contacts [MrPetovan]
Fixed the version sorting in the federation statistics page [annando]
Fixed a bug in the nodeinfo calculation of total comments [annando]
Fixed a bug during registration that prevented the detected language to be saved [tobiasd]
Added an optional module to display the Terms of Service [rabuzarus, tobiasd]
Added testfeed module [MrPetovan]
Added hashtag autocomplete (ported from Hubzilla) [rabuzarus]
Added password exposed check [MrPetovan]
Added preloading config adapter [MrPetovan]
Added a console to unify the PHP utility scripts [MrPetovan]
Added a tool to set user passwords to the console [annando]
Added memcached support [MrPetovan]
Added password exposure check [MrPetovan]
Added hashtag autocompletion [rabuzarus]
Added feedtest module [MrPetovan]
Added dbclean options to the admin panel [annando]
Added the possibility to add the remote_self flag to contacts from diaspora* and Twitter [annando]
Added the possibility of automatic installations [M-arcus]
Added the sending of a notification mail to the admin when a user deletes their account [tobiasd]
Added examples for home.html and home.css files [tobiasd]
Added an option to define after how many days a contact should be archived [annando]
Added parts of the list API [rudloff]
Added support of ALT texts for images [annando]
Removed the connection postings [annando]
Corrected a long standing typo in config variable names; should your bandwidth saver mode stop working please turn it off and on again [abanink]
The execute-ables were moved from /util to /bin [MrPetovan]
The execute-ables for the developers were moved from /util to /bin/dev [MrPetovan]
The last year deprecated themes frost and frost mobile got removed from the Friendica repository. They can be found in the dedicated repository for deprecated themes [tobiasd]
General code refactoring and beautification work [annando, MrPetovan, rudloff]
Switched to cropperjs to better support touch screen devices [rabuzarus]
Use the diaspora transport layer for the DFRN protocol as well [annando]
Friendica Addons:
Updates to the translations (DE, EN_GB, EN_US, ES, FI, FR, IS, IT, NL, PL, RU, ZH_CN) [translation teams]
advancedcontentfilter: new addon with advanced filter capabilities [MrPetova]
catavatar: new addon for profile pictures based on David Revoy's cat-avatar generator [annando, fabrixxm, tobiasd]
languagefilter: better help text [andyhee]
mathjax: fixed the config form and adopted new CDN URL [tobiasd]
NSFW: add hashtag only hiding [MrPetovan]
notifyall: fixed a bug in handling the sender name [tobiasd]
Twitter: fixed a bug during the creation of public contacts [annando]
Twitter: remote self now also works for Twitter contacts [annando]
Twitter: optimizations for sending media [annando]
Closed Issues:
839, 1186, 1729, 2115, 2247, 2781, 2880, 3174, 3395, 3409, 3412,
3611, 3834, 3837, 3979, 4146, 4572, 4601, 4616, 4629, 4647, 4660,
4661, 4663, 4664, 4665, 4666, 4669, 4670, 4681, 4695, 4670, 4689,
4730, 4749, 4760, 4772, 4786, 4790, 4791, 4816, 4867, 4878, 4819,
4860, 4876, 4879, 4886, 4898, 4899, 4902, 4921, 4926, 4927, 4928,
4938, 4943, 4946, 4947, 4965, 4976, 4966, 4994, 4997, 5002, 5014,
5033, 5043, 5050, 5051, 5056, 5063, 5067, 5010, 5111, 5116, 5128,
5137, 5147
Version 3.6 (2018-03-23)
Friendica Core:
Updates to the translations (DE, EN_GB, EN_US, ES, FR, IT, ZH_CN) [translation teams]
@ -93,6 +195,8 @@ Version 3.6 (2018-03-23)
Updates to the translations (DE, EN_GB, ES, FR, IT, NL, ZH_CN) [translation teams]
all bridges don't relay postings anymore that are posted to a public forum [annando]
DAV addon marked unsupported [tobiasd]
communityhome addon marked unsupported [MrPetovan]
yourls addon makrked unsupported [MrPetovan]
Current Weather: fixing a problem with the weathermap link [zeroadam]
NSFW added config examples, reworked the description, now ignores the CW from Mastodon [andyhee, annando, rebeka-catalina]
Twitter support 280 chars limit [annando]
@ -102,7 +206,7 @@ Version 3.6 (2018-03-23)
Public Server reworked [annando]
pageheader settings beautifications [tobiasd]
mailstream settings beautifications [tobiasd]
Membersince is now part of the core [rabuzarus]
Membersince is now part of the core, addon marked unsupported [rabuzarus]
Forum posts are not transmitted over the connectors anymore [annando]
Friendica Dir:

View file

@ -1 +1 @@
2018-05-dev
2018.08-dev

View file

@ -29,7 +29,7 @@ dontinclude = ['root', 'friendica', 'bavatar', 'tony baldwin', 'Taek', 'silke m'
# this script is in the /util sub-directory of the friendica installation
# so the friendica path is the 0th argument of calling this script but we
# need to remove the name of the file and the name of the directory
path = os.path.abspath(argv[0].split('util/make_credits.py')[0])
path = os.path.abspath(argv[0].split('bin/dev/make_credits.py')[0])
print('> base directory is assumed to be: '+path)
# a place to store contributors
contributors = ["Andi Stadler", "Ratten", "Vít Šesták 'v6ak'"]

View file

@ -48,7 +48,7 @@ case "$MODE" in
OUTFILE="$FULLPATH/../util/messages.po"
FINDSTARTDIR="."
# skip addon folder
FINDOPTS="( -wholename */addon -or -wholename */addons-extra -or -wholename */smarty3 ) -prune -o"
FINDOPTS="( -wholename */addon -or -wholename */addons -or -wholename */addons-extra -or -wholename */smarty3 ) -prune -o"
F9KVERSION=$(sed -n "s/.*'FRIENDICA_VERSION'.*'\([0-9.]*\)'.*/\1/p" ./boot.php);
echo "Friendica version $F9KVERSION"

View file

@ -39,9 +39,9 @@ require_once 'include/text.php';
define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
define('FRIENDICA_VERSION', '2018-05-dev');
define('FRIENDICA_VERSION', '2018.08-dev');
define('DFRN_PROTOCOL_VERSION', '2.23');
define('DB_UPDATE_VERSION', 1260);
define('DB_UPDATE_VERSION', 1267);
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/**

View file

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2018-05-dev (The Tazmans Flax-lily)
-- DB_UPDATE_VERSION 1260
-- Friendica 2018.08-dev (The Tazmans Flax-lily)
-- DB_UPDATE_VERSION 1267
-- ------------------------------------------
@ -855,10 +855,13 @@ CREATE TABLE IF NOT EXISTS `push_subscriber` (
`callback_url` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`push` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '',
`last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
`last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
`next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
`renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
`secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
PRIMARY KEY(`id`)
PRIMARY KEY(`id`),
INDEX `next_try` (`next_try`)
) DEFAULT COLLATE utf8mb4_general_ci;
--
@ -1073,6 +1076,16 @@ CREATE TABLE IF NOT EXISTS `userd` (
INDEX `username` (`username`(32))
) DEFAULT COLLATE utf8mb4_general_ci;
--
-- TABLE user-item
--
CREATE TABLE IF NOT EXISTS `user-item` (
`iid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Item id',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`hidden` boolean NOT NULL DEFAULT '0' COMMENT 'Hidden marker',
PRIMARY KEY(`uid`,`iid`)
) DEFAULT COLLATE utf8mb4_general_ci;
--
-- TABLE workerqueue
--
@ -1088,7 +1101,7 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
INDEX `pid` (`pid`),
INDEX `parameter` (`parameter`(64)),
INDEX `priority_created` (`priority`,`created`),
INDEX `executed` (`executed`)
INDEX `done_executed` (`done`,`executed`)
) DEFAULT COLLATE utf8mb4_general_ci;

View file

@ -34,6 +34,7 @@ Friendica Documentation and Resources
* [Using SSL with Friendica](help/SSL)
* [Config values that can only be set in .htconfig.php](help/htconfig)
* [Improve Performance](help/Improve-Performance)
* [Administration Tools](help/tools)
**Developer Manual**

View file

@ -23,16 +23,19 @@ You can tag a person on a different network or one that is **not in your social
Unless their system blocks unsolicited "mentions", the person tagged will likely receive a "Mention" post/activity or become a direct participant in the conversation in the case of public posts.
Friendica blocks incoming “mentions” from people with no relationship to you.
The exception is an ongiong conversation started from a contact of both you and the 3rd person or a conversation in a forum where you are a member of.
The exception is an ongoing conversation started from a contact of both you and the 3rd person or a conversation in a forum where you are a member of.
This is a spam prevention measure.
Remote mentions are delivered using the OStatus protocol.
This protocol is used by Friendica and GNU Social and several other systems, but is not currently implemented in Diaspora.
This protocol is used by Friendica and GNU Social and several other systems like Mastodon, but is not currently implemented in Diaspora.
As the OStatus protocol allows this Friendica user can be @-mentioned by users from platforms using this protocol in conversations if the "Enable OStatus support" is activated on the Friendica node.
These @-mentions wont be blocked, even if there is no relationship between the sender and the receiver of the message.
Friendica makes no distinction between people and forums for the purpose of tagging.
(Some other networks use !forum to indicate a forum.)
You can use @-mentions for forums like for other accounts to tag the forum.
If you want to post something exclusively to a forum (e.g. the support forum) please use the bang-notation instead of the @tag.
So !helpers will be an exclusive posting to the support forum if you are connected with the forum.
If you select a forum from the ACL a !-mention will be added automatically to your posting.
If you sort your contacts into groups, you cannot @-mention these groups.
But you can select the group in the access control when creating a new posting, to allow (or disallow) a certain group of people to see the posting.
@ -40,11 +43,14 @@ See [Groups and Privacy](help/Groups-and-Privacy) for more details about groupin
**Topical Tags**
Topical tags are indicated by preceding the tag name with the # character. This will create a link in the post to a generalised site search for the term provided. For example, #cars will provide a search link for all posts mentioning 'cars' on your site. Topical tags are generally a minimum of three characters in length. Shorter search terms are not likely to yield any search results, although this depends on the database configuration. The same rules apply as with names that spaces within tags are represented by the underscore character. It is therefore not possible to create a tag whose target contains an underscore.
Topical tags are also not linked if they are purely numeric, e.g. #1. If you wish to use a numerica hashtag, please add some descriptive text such as #2012-elections.
Topical tags are indicated by preceding the tag name with the # character.
This will create a link in the post to a generalised site search for the term provided.
For example, #cars will provide a search link for all posts mentioning 'cars' on your site.
Topical tags are generally a minimum of three characters in length.
Shorter search terms are not likely to yield any search results, although this depends on the database configuration.
The same rules apply as with names that spaces within tags are represented by the underscore character.
It is therefore not possible to create a tag whose target contains an underscore.
Topical tags are also not linked if they are purely numeric, e.g. #1.
If you wish to use a numerica hashtag, please add some descriptive text such as #2012-elections.

View file

@ -36,6 +36,7 @@ Friendica - Dokumentation und Ressourcen
* [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL)
* [Konfigurationswerte, die nur in der .htconfig.php gesetzt werden können](help/htconfig) (EN)
* [Performance verbessern](help/Improve-Performance)
* [Administration Werkzeuge](help/tools) (EN)
**Dokumentation für Entwickler**

76
doc/tools.md Normal file
View file

@ -0,0 +1,76 @@
Admin Tools
===========
* [Home](help)
Friendica Tools
---------------
Friendica has a build in command console you can find in the *bin* directory.
The console provides the following commands:
* config: Edit site config
* createdoxygen: Generate Doxygen headers
* dbstructure: Do database updates
* docbloxerrorchecker: Check the file tree for DocBlox errors
* extract: Generate translation string file for the Friendica project (deprecated)
* globalcommunityblock: Block remote profile from interacting with this node
* globalcommunitysilence: Silence remote profile from global community page
* archivecontact: Archive a contact when you know that it isn't existing anymore
* help: Show help about a command, e.g (bin/console help config)
* autoinstall: Starts automatic installation of friendica based on values from htconfig.php
* maintenance: Set maintenance mode for this node
* newpassword: Set a new password for a given user
* php2po: Generate a messages.po file from a strings.php file
* po2php: Generate a strings.php file from a messages.po file
* typo: Checks for parse errors in Friendica files
Please consult *bin/console help* on the command line interface of your server for details about the commands.
3rd Party Tools
---------------
In addition to the tools Friendica includes, some 3rd party tools can make your admin days easier.
### Fail2ban
Fail2ban is an intrusion prevention framework ([see Wikipedia](https://en.wikipedia.org/wiki/Fail2ban)) that you can use to forbid access to a server under certain conditions, e.g. 3 failed attempts to log in, for a certain amount of time.
The following configuration was [provided](https://forum.friendi.ca/display/174591b4135ae40c1ad7e93897572454) by Steffen K9 using Debian.
You need to adjust the *logpath* in the *jail.local* file and the *bantime* (value is in seconds).
In */etc/fail2ban/jail.local* create a section for Friendica:
[friendica]
enabled = true
findtime = 300
bantime = 900
filter = friendica
port = http,https
logpath = /var/log/friend.log
logencoding = utf-8
And create a filter definition in */etc/fail2ban/filter.d/friendica.conf*:
[Definition]
failregex = ^.*Login\.php.*failed login attempt.*from IP <HOST>.*$
ignoreregex =
Additionally you have to define the number of failed logins before the ban should be activated.
This is done either in the global configuration or for each jail separately.
You should inform your users about the number of failed login attempts you grant them.
Otherwise you'll get many reports about the server not functioning if the number is too low.
### Log rotation
If you have activated the logs in Friendica, be aware that they can grow to a significant size.
To keep them in control you should add them to the automatic [log rotation](https://en.wikipedia.org/wiki/Log_rotation), e.g. using the *logrotate* command.
In */etc/logrotate.d/* add a file called *friendica* that contains the configuration.
The following will compress */var/log/friendica* (assuming this is the location of the log file) on a daily basis and keep 2 days of back-log.
/var/log/friendica.log {
compress
daily
rotate 2
}

View file

@ -24,11 +24,15 @@ $db_data = 'mysqldatabasename';
// Use environment variables for mysql if they are set beforehand
if (!empty(getenv('MYSQL_HOST'))
&& !empty(getenv('MYSQL_PORT'))
&& !empty(getenv('MYSQL_USERNAME'))
&& (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
&& !empty(getenv('MYSQL_PASSWORD'))
&& !empty(getenv('MYSQL_DATABASE'))) {
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
if (!empty(getenv('MYSQL_USERNAME'))) {
$db_user = getenv('MYSQL_USERNAME');
} elseif (!empty(getenv('MYSQL_USER'))) {
$db_user = getenv('MYSQL_USER');
}
$db_pass = getenv('MYSQL_PASSWORD');
$db_data = getenv('MYSQL_DATABASE');
}

View file

@ -1663,7 +1663,7 @@ function api_search($type)
$r = dba::p(
"SELECT ".item_fieldlists()."
FROM `item` ".item_joins()."
FROM `item` ".item_joins(api_user())."
WHERE ".item_condition()." AND (`item`.`uid` = 0 OR (`item`.`uid` = ? AND NOT `item`.`global`))
AND `item`.`body` LIKE CONCAT('%',?,'%')
$sql_extra
@ -1827,7 +1827,7 @@ function api_statuses_public_timeline($type)
"SELECT " . item_fieldlists() . "
FROM `thread`
STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
" . item_joins() . "
" . item_joins(api_user()) . "
STRAIGHT_JOIN `user` ON `user`.`uid` = `thread`.`uid`
AND NOT `user`.`hidewall`
AND `verb` = ?
@ -1856,7 +1856,7 @@ function api_statuses_public_timeline($type)
$r = dba::p(
"SELECT " . item_fieldlists() . "
FROM `item`
" . item_joins() . "
" . item_joins(api_user()) . "
STRAIGHT_JOIN `user` ON `user`.`uid` = `item`.`uid`
AND NOT `user`.`hidewall`
AND `verb` = ?
@ -1930,7 +1930,7 @@ function api_statuses_networkpublic_timeline($type)
"SELECT " . item_fieldlists() . "
FROM `thread`
STRAIGHT_JOIN `item` ON `item`.`id` = `thread`.`iid`
" . item_joins() . "
" . item_joins(api_user()) . "
WHERE `thread`.`uid` = 0
AND `verb` = ?
AND NOT `thread`.`private`
@ -2002,6 +2002,19 @@ function api_statuses_show($type)
$sql_extra .= " AND `item`.`id` = %d";
}
// try to fetch the item for the local user - or the public item, if there is no local one
$uri_item = dba::selectFirst('item', ['uri'], ['id' => $id]);
if (!DBM::is_result($uri_item)) {
throw new BadRequestException("There is no status with this id.");
}
$item = dba::selectFirst('item', ['id'], ['uri' => $uri_item['uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
if (!DBM::is_result($item)) {
throw new BadRequestException("There is no status with this id.");
}
$id = $item['id'];
$r = q(
"SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@ -2011,7 +2024,7 @@ function api_statuses_show($type)
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND `contact`.`uid` = `item`.`uid`
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
WHERE `item`.`visible` AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND `item`.`uid` = %d AND `item`.`verb` = '%s'
AND `item`.`uid` IN (0, %d) AND `item`.`verb` = '%s'
$sql_extra",
intval(api_user()),
dbesc(ACTIVITY_POST),
@ -2075,22 +2088,25 @@ function api_conversation_show($type)
logger('API: api_conversation_show: '.$id);
$r = q("SELECT `parent` FROM `item` WHERE `id` = %d", intval($id));
if (DBM::is_result($r)) {
$id = $r[0]["parent"];
// try to fetch the item for the local user - or the public item, if there is no local one
$item = dba::selectFirst('item', ['parent-uri'], ['id' => $id]);
if (!DBM::is_result($item)) {
throw new BadRequestException("There is no status with this id.");
}
$parent = dba::selectFirst('item', ['id'], ['uri' => $item['parent-uri'], 'uid' => [0, api_user()]], ['order' => ['uid' => true]]);
if (!DBM::is_result($parent)) {
throw new BadRequestException("There is no status with this id.");
}
$id = $parent['id'];
$sql_extra = '';
if ($max_id > 0) {
$sql_extra = ' AND `item`.`id` <= ' . intval($max_id);
}
// Not sure why this query was so complicated. We should keep it here for a while,
// just to make sure that we really don't need it.
// FROM `item` INNER JOIN (SELECT `uri`,`parent` FROM `item` WHERE `id` = %d) AS `temp1`
// ON (`item`.`thr-parent` = `temp1`.`uri` AND `item`.`parent` = `temp1`.`parent`)
$r = q(
"SELECT `item`.*, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`,
`contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
@ -2101,7 +2117,7 @@ function api_conversation_show($type)
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
WHERE `item`.`parent` = %d AND `item`.`visible`
AND NOT `item`.`moderated` AND NOT `item`.`deleted`
AND `item`.`uid` = %d AND `item`.`verb` = '%s'
AND `item`.`uid` IN (0, %d) AND `item`.`verb` = '%s'
AND `item`.`id`>%d $sql_extra
ORDER BY `item`.`id` DESC LIMIT %d ,%d",
intval($id),
@ -2240,7 +2256,7 @@ function api_statuses_destroy($type)
$ret = api_statuses_show($type);
Item::deleteById($id);
Item::deleteForUser(['id' => $id], api_user());
return $ret;
}
@ -4132,7 +4148,7 @@ function api_fr_photoalbum_delete($type)
if (!DBM::is_result($photo_item)) {
throw new InternalServerErrorException("problem with deleting items occured");
}
Item::deleteById($photo_item[0]['id']);
Item::deleteForUser(['id' => $photo_item[0]['id']], api_user());
}
// now let's delete all photos from the album
@ -4424,7 +4440,7 @@ function api_fr_photo_delete($type)
}
// function for setting the items to "deleted = 1" which ensures that comments, likes etc. are not shown anymore
// to the user and the contacts of the users (drop_items() do all the necessary magic to avoid orphans in database and federate deletion)
Item::deleteById($photo_item[0]['id']);
Item::deleteForUser(['id' => $photo_item[0]['id']], api_user());
$answer = ['result' => 'deleted', 'message' => 'photo with id `' . $photo_id . '` has been deleted from server.'];
return api_format_data("photo_delete", $type, ['$result' => $answer]);

View file

@ -401,10 +401,12 @@ function visible_activity($item) {
/**
* @brief SQL query for items
*
* @param int $uid user id
*/
function item_query() {
function item_query($uid = 0) {
return "SELECT " . item_fieldlists() . " FROM `item` " .
item_joins() . " WHERE " . item_condition();
item_joins($uid) . " WHERE " . item_condition();
}
/**
@ -429,7 +431,6 @@ These Fields are not added below (yet). They are here to for bug search.
`item`.`bookmark`,
`item`.`unseen`,
`item`.`deleted`,
`item`.`origin`,
`item`.`forum_mode`,
`item`.`mention`,
`item`.`global`,
@ -442,7 +443,7 @@ These Fields are not added below (yet). They are here to for bug search.
`item`.`uri`, `item`.`thr-parent`, `item`.`parent-uri`, `item`.`content-warning`,
`item`.`commented`, `item`.`created`, `item`.`edited`, `item`.`received`,
`item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`,
`item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`,
`item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`, `item`.`origin`,
`item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`,
`item`.`location`, `item`.`coord`, `item`.`app`, `item`.`attach`,
`item`.`rendered-hash`, `item`.`rendered-html`, `item`.`object`,
@ -464,16 +465,19 @@ These Fields are not added below (yet). They are here to for bug search.
/**
* @brief SQL join for contacts that are needed for displaying items
*
* @param int $uid user id
*/
function item_joins() {
function item_joins($uid = 0) {
return sprintf("STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
AND NOT `contact`.`blocked`
AND ((NOT `contact`.`readonly` AND NOT `contact`.`pending` AND (`contact`.`rel` IN (%s, %s)))
OR `contact`.`self` OR (`item`.`id` != `item`.`parent`))
OR `contact`.`self` OR (`item`.`id` != `item`.`parent`) OR `contact`.`uid` = 0)
INNER JOIN `contact` AS `author` ON `author`.`id`=`item`.`author-id` AND NOT `author`.`blocked`
INNER JOIN `contact` AS `owner` ON `owner`.`id`=`item`.`owner-id` AND NOT `owner`.`blocked`
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
LEFT JOIN `event` ON `event-id` = `event`.`id`",
CONTACT_IS_SHARING, CONTACT_IS_FRIEND
CONTACT_IS_SHARING, CONTACT_IS_FRIEND, intval($uid)
);
}
@ -481,7 +485,7 @@ function item_joins() {
* @brief SQL condition for items that are needed for displaying items
*/
function item_condition() {
return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`";
return "`item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated` AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`) ";
}
/**
@ -494,7 +498,7 @@ function item_condition() {
* that are based on unique features of the calling module.
*
*/
function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'commented') {
function conversation(App $a, $items, $mode, $update, $preview = false, $order = 'commented', $uid = 0) {
require_once 'mod/proxy.php';
$ssl_state = ((local_user()) ? true : false);
@ -518,7 +522,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
$previewing = (($preview) ? ' preview ' : '');
if ($mode === 'network') {
$items = conversation_add_children($items, false, $order);
$items = conversation_add_children($items, false, $order, $uid);
$profile_owner = local_user();
if (!$update) {
/*
@ -579,7 +583,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
. " var profile_page = 1; </script>";
}
} elseif ($mode === 'community') {
$items = conversation_add_children($items, true, $order);
$items = conversation_add_children($items, true, $order, $uid);
$profile_owner = 0;
if (!$update) {
$live_update_div = '<div id="live-community"></div>' . "\r\n"
@ -882,7 +886,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false, $order =
*
* @return array items with parents and comments
*/
function conversation_add_children($parents, $block_authors, $order) {
function conversation_add_children($parents, $block_authors, $order, $uid) {
$max_comments = Config::get('system', 'max_comments', 100);
if ($max_comments > 0) {
@ -896,37 +900,12 @@ function conversation_add_children($parents, $block_authors, $order) {
$block_sql = $block_authors ? "AND NOT `author`.`hidden` AND NOT `author`.`blocked`" : "";
foreach ($parents AS $parent) {
$thread_items = dba::p(item_query()." AND `item`.`uid` = ?
AND `item`.`parent-uri` = ? $block_sql
ORDER BY `item`.`commented` DESC" . $limit,
local_user(),
$parent['uri']
);
$comments = dba::inArray($thread_items);
$thread_items = dba::p(item_query(local_user())."AND `item`.`parent-uri` = ?
AND `item`.`uid` IN (0, ?) $block_sql
ORDER BY `item`.`uid` ASC, `item`.`commented` DESC" . $limit,
$parent['uri'], local_user());
// Check if the original item is in the result.
// When commenting from the community page there can be incomplete threads
if (count($comments) > 0) {
$parent_found = false;
foreach ($comments as $comment) {
if ($comment['uri'] == $comment['parent-uri']) {
$parent_found = true;
break;
}
}
if (!$parent_found) {
$comments = [];
}
}
if (count($comments) == 0) {
$thread_items = dba::p(item_query()." AND `item`.`uid` = 0
AND `item`.`parent-uri` = ?
ORDER BY `item`.`commented` DESC LIMIT ".intval($max_comments + 1),
$parent['uri']
);
$comments = dba::inArray($thread_items);
}
if (count($comments) != 0) {
$items = array_merge($items, $comments);

View file

@ -52,16 +52,6 @@ class dba {
return false;
}
if ($a->mode == App::MODE_INSTALL) {
// server has to be a non-empty string that is not 'localhost' and not an IP
if (strlen($server) && ($server !== 'localhost') && filter_var($server, FILTER_VALIDATE_IP) === false) {
if (! dns_get_record($server, DNS_A + DNS_CNAME)) {
self::$error = L10n::t('Cannot locate DNS info for database server \'%s\'', $server);
return false;
}
}
}
if (class_exists('\PDO') && in_array('mysql', PDO::getAvailableDrivers())) {
self::$driver = 'pdo';
$connect = "mysql:host=".$server.";dbname=".$db;

View file

@ -29,7 +29,7 @@ function add_page_info_data($data, $no_photos = false) {
// It maybe is a rich content, but if it does have everything that a link has,
// then treat it that way
if (($data["type"] == "rich") && is_string($data["title"]) &&
is_string($data["text"]) && (sizeof($data["images"]) > 0)) {
is_string($data["text"]) && !empty($data["images"])) {
$data["type"] = "link";
}
@ -63,7 +63,7 @@ function add_page_info_data($data, $no_photos = false) {
$text .= " title='".$data["title"]."'";
}
if (sizeof($data["images"]) > 0) {
if (!empty($data["images"])) {
$preview = str_replace(["[", "]"], ["&#91;", "&#93;"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
// if the preview picture is larger than 500 pixels then show it in a larger mode
// But only, if the picture isn't higher than large (To prevent huge posts)
@ -322,7 +322,7 @@ function drop_items($items) {
if (count($items)) {
foreach ($items as $item) {
$owner = Item::deleteById($item);
$owner = Item::deleteForUser(['id' => $item], local_user());
if ($owner && !$uid)
$uid = $owner;
}
@ -394,7 +394,7 @@ function drop_item($id) {
}
// delete the item
Item::deleteById($item['id']);
Item::deleteForUser(['id' => $item['id']], local_user());
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
//NOTREACHED

View file

@ -14,6 +14,7 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Event;
use Friendica\Model\Item;
use Friendica\Model\Profile;
@ -1966,6 +1967,10 @@ function undo_post_tagging($s) {
$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::getDetailsByURL($mtch[2]);
$mtch[3] = empty($contact['addr']) ? $mtch[2] : $contact['addr'];
}
$s = str_replace($mtch[0], $mtch[1] . $mtch[3],$s);
}
}

View file

@ -73,8 +73,8 @@ function wk_social_relay()
'subscribe' => $subscribe,
'scope' => $scope,
'tags' => $taglist,
'protocols' => ['diaspora' => System::baseUrl() . '/receive/public',
'dfrn' => System::baseUrl() . '/dfrn_notify']
'protocols' => ['diaspora' => ['receive' => System::baseUrl() . '/receive/public'],
'dfrn' => ['receive' => System::baseUrl() . '/dfrn_notify']]
];
header('Content-type: application/json; charset=utf-8');

View file

@ -20,6 +20,7 @@ use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\Login;
use Friendica\Module\Tos;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
@ -296,12 +297,15 @@ function admin_content(App $a)
*/
function admin_page_tos(App $a)
{
$tos = new Tos();
$t = get_markup_template('admin/tos.tpl');
return replace_macros($t, [
'$title' => L10n::t('Administration'),
'$page' => L10n::t('Terms of Service'),
'$displaytos' => ['displaytos', L10n::t('Display Terms of Service'), Config::get('system', 'tosdisplay'), L10n::t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')],
'$displayprivstatement' => ['displayprivstatement', L10n::t('Display Privacy Statement'), Config::get('system','tosprivstatement'), L10n::t('Show some informations regarding the needed information to operate the node according e.g. to <a href="%s" target="_blank">EU-GDPR</a>.','https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')],
'$preview' => L10n::t('Privacy Statement Preview'),
'$privtext' => $tos->privacy_complete,
'$tostext' => ['tostext', L10n::t('The Terms of Service'), Config::get('system', 'tostext'), L10n::t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')],
'$form_security_token' => get_form_security_token("admin_tos"),
'$submit' => L10n::t('Save Settings'),
@ -551,14 +555,9 @@ function admin_page_deleteitem_post(App $a)
if (strpos($guid, '/')) {
$guid = substr($guid, strrpos($guid, '/') + 1);
}
// Now that we have the GUID get all IDs of the associated entries in the
// item table of the DB and drop those items, which will also delete the
// Now that we have the GUID, drop those items, which will also delete the
// associated threads.
$r = dba::select('item', ['id'], ['guid' => $guid]);
while ($row = dba::fetch($r)) {
Item::deleteById($row['id']);
}
dba::close($r);
Item::delete(['guid' => $guid]);
}
info(L10n::t('Item marked for deletion.') . EOL);
@ -1345,16 +1344,12 @@ function admin_page_site(App $a)
}
$diaspora_able = ($a->get_path() == "");
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', 100);
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
if ($optimize_max_tablesize < -1) {
if ($optimize_max_tablesize <= 0) {
$optimize_max_tablesize = -1;
}
if ($optimize_max_tablesize == 0) {
$optimize_max_tablesize = 100;
}
$t = get_markup_template('admin/site.tpl');
return replace_macros($t, [
'$title' => L10n::t('Administration'),
@ -1399,7 +1394,7 @@ function admin_page_site(App $a)
'$no_oembed_rich_content' => ['no_oembed_rich_content', L10n::t("No OEmbed rich content"), Config::get('system','no_oembed_rich_content'), L10n::t("Don't show the rich content \x28e.g. embedded PDF\x29, except from the domains listed below.")],
'$allowed_oembed' => ['allowed_oembed', L10n::t("Allowed OEmbed domains"), Config::get('system','allowed_oembed'), L10n::t("Comma separated list of domains which oembed content is allowed to be displayed. Wildcards are accepted.")],
'$block_public' => ['block_public', L10n::t("Block public"), Config::get('system','block_public'), L10n::t("Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.")],
'$force_publish' => ['publish_all', L10n::t("Force publish"), Config::get('system','publish_all'), L10n::t("Check to force all profiles on this site to be listed in the site directory.")],
'$force_publish' => ['publish_all', L10n::t("Force publish"), Config::get('system','publish_all'), L10n::t("Check to force all profiles on this site to be listed in the site directory.") . '<strong>' . L10n::t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
'$global_directory' => ['directory', L10n::t("Global directory URL"), Config::get('system', 'directory', 'https://dir.friendica.social'), L10n::t("URL to the global directory. If this is not set, the global directory is completely unavailable to the application.")],
'$newuser_private' => ['newuser_private', L10n::t("Private posts by default for new users"), Config::get('system','newuser_private'), L10n::t("Set default post permissions for all new members to the default privacy group rather than public.")],
'$enotify_no_content' => ['enotify_no_content', L10n::t("Don't include post content in email notifications"), Config::get('system','enotify_no_content'), L10n::t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")],
@ -1425,7 +1420,7 @@ function admin_page_site(App $a)
'$maxloadavg' => ['maxloadavg', L10n::t("Maximum Load Average"), Config::get('system', 'maxloadavg', 50), L10n::t("Maximum system load before delivery and poll processes are deferred - default 50.")],
'$maxloadavg_frontend' => ['maxloadavg_frontend', L10n::t("Maximum Load Average \x28Frontend\x29"), Config::get('system', 'maxloadavg_frontend', 50), L10n::t("Maximum system load before the frontend quits service - default 50.")],
'$min_memory' => ['min_memory', L10n::t("Minimal Memory"), Config::get('system', 'min_memory', 0), L10n::t("Minimal free memory in MB for the worker. Needs access to /proc/meminfo - default 0 \x28deactivated\x29.")],
'$optimize_max_tablesize'=> ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization - default 100 MB. Enter -1 to disable it.")],
'$optimize_max_tablesize'=> ['optimize_max_tablesize', L10n::t("Maximum table size for optimization"), $optimize_max_tablesize, L10n::t("Maximum table size \x28in MB\x29 for the automatic optimization. Enter -1 to disable it.")],
'$optimize_fragmentation'=> ['optimize_fragmentation', L10n::t("Minimum level of fragmentation"), Config::get('system', 'optimize_fragmentation', 30), L10n::t("Minimum fragmenation level to start the automatic optimization - default value is 30%.")],
'$poco_completion' => ['poco_completion', L10n::t("Periodical check of global contacts"), Config::get('system','poco_completion'), L10n::t("If enabled, the global contacts are checked periodically for missing or outdated data and the vitality of the contacts and servers.")],
@ -1446,7 +1441,7 @@ function admin_page_site(App $a)
'$max_comments' => ['max_comments', L10n::t("Maximum numbers of comments per post"), Config::get('system','max_comments'), L10n::t("How much comments should be shown for each post? Default value is 100.")],
'$temppath' => ['temppath', L10n::t("Temp path"), Config::get('system','temppath'), L10n::t("If you have a restricted system where the webserver can't access the system temp path, enter another path here.")],
'$basepath' => ['basepath', L10n::t("Base path to installation"), Config::get('system','basepath'), L10n::t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot.")],
'$proxy_disabled' => ['proxy_disabled', L10n::t("Disable picture proxy"), Config::get('system','proxy_disabled'), L10n::t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwith.")],
'$proxy_disabled' => ['proxy_disabled', L10n::t("Disable picture proxy"), Config::get('system','proxy_disabled'), L10n::t("The picture proxy increases performance and privacy. It shouldn't be used on systems with very low bandwidth.")],
'$only_tag_search' => ['only_tag_search', L10n::t("Only search in tags"), Config::get('system','only_tag_search'), L10n::t("On large systems the text search can slow down the system extremely.")],
'$relocate_url' => ['relocate_url', L10n::t("New base url"), System::baseUrl(), L10n::t("Change base url for this server. Sends relocate message to all Friendica and Diaspora* contacts of all users.")],

View file

@ -171,7 +171,7 @@ function community_content(App $a, $update = 0)
$s = $r;
}
$o .= conversation($a, $s, 'community', $update);
$o .= conversation($a, $s, 'community', $update, false, 'commented', local_user());
if (!$update) {
$o .= alt_pager($a, count($r));

View file

@ -83,14 +83,12 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$duplex = $handsfree['duplex'];
$cid = 0;
$hidden = intval(defaults($handsfree, 'hidden' , 0));
$activity = intval(defaults($handsfree, 'activity', 0));
} else {
$dfrn_id = notags(trim(defaults($_POST, 'dfrn_id' , '')));
$intro_id = intval(defaults($_POST, 'intro_id' , 0));
$duplex = intval(defaults($_POST, 'duplex' , 0));
$cid = intval(defaults($_POST, 'contact_id', 0));
$hidden = intval(defaults($_POST, 'hidden' , 0));
$activity = intval(defaults($_POST, 'activity' , 0));
}
/*
@ -284,6 +282,11 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
if (($status == 0) && $intro_id) {
$intro = dba::selectFirst('intro', ['note'], ['id' => $intro_id]);
if (DBM::is_result($intro)) {
dba::update('contact', ['reason' => $intro['note']], ['id' => $contact_id]);
}
// Success. Delete the notification.
dba::delete('intro', ['id' => $intro_id]);
}
@ -385,7 +388,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
);
}
/// @TODO is DBM::is_result() working here?
if (!DBM::is_result($r)) {
notice(L10n::t('Unable to set contact photo.') . EOL);
}
@ -397,50 +399,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$ret = Diaspora::sendShare($user, $contact);
logger('share returns: ' . $ret);
}
// Send a new friend post if we are allowed to...
$profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $uid]);
if (x($profile, 'hide-friends') === 0 && $activity && !$hidden) {
$self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $uid]);
if (DBM::is_result($self)) {
$arr = [];
$arr['guid'] = get_guid(32);
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
$arr['uid'] = $uid;
$arr['contact-id'] = $self['id'];
$arr['wall'] = 1;
$arr['type'] = 'wall';
$arr['gravity'] = 0;
$arr['origin'] = 1;
$arr['author-name'] = $arr['owner-name'] = $self['name'];
$arr['author-link'] = $arr['owner-link'] = $self['url'];
$arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb'];
$A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]';
$B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
$arr['verb'] = ACTIVITY_FRIEND;
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
$arr['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B) . "\n\n\n" . $BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
. '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
$arr['allow_cid'] = $user['allow_cid'];
$arr['allow_gid'] = $user['allow_gid'];
$arr['deny_cid'] = $user['deny_cid'];
$arr['deny_gid'] = $user['deny_gid'];
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
}
}
}
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
@ -661,49 +619,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
}
}
// Send a new friend post if we are allowed to...
if ($page && intval(PConfig::get($local_uid, 'system', 'post_joingroup'))) {
$profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $local_uid]);
if (x($profile, 'hide-friends') === 0) {
$self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $local_uid]);
if (DBM::is_result($self)) {
$arr = [];
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid);
$arr['uid'] = $local_uid;
$arr['contact-id'] = $self['id'];
$arr['wall'] = 1;
$arr['type'] = 'wall';
$arr['gravity'] = 0;
$arr['origin'] = 1;
$arr['author-name'] = $arr['owner-name'] = $self['name'];
$arr['author-link'] = $arr['owner-link'] = $self['url'];
$arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb'];
$A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]';
$B = '[url=' . $combined['url'] . ']' . $combined['name'] . '[/url]';
$BPhoto = '[url=' . $combined['url'] . ']' . '[img]' . $combined['thumb'] . '[/img][/url]';
$arr['verb'] = ACTIVITY_JOIN;
$arr['object-type'] = ACTIVITY_OBJ_GROUP;
$arr['body'] = L10n::t('%1$s has joined %2$s', $A, $B) . "\n\n\n" . $BPhoto;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_GROUP . '</type><title>' . $combined['name'] . '</title>'
. '<id>' . $combined['url'] . '/' . $combined['name'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $combined['url'] . '" />' . "\n");
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $combined['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
$arr['allow_cid'] = $user['allow_cid'];
$arr['allow_gid'] = $user['allow_gid'];
$arr['deny_cid'] = $user['deny_cid'];
$arr['deny_gid'] = $user['deny_gid'];
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
}
}
}
System::xmlExit(0); // Success
return; // NOTREACHED
////////////////////// End of this scenario ///////////////////////////////////////////////

View file

@ -577,7 +577,6 @@ function dfrn_request_content(App $a)
'dfrn_id' => $r[0]['issued-id'],
'intro_id' => $intro[0]['id'],
'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0),
'activity' => intval(PConfig::get($r[0]['uid'], 'system', 'post_newfriend'))
];
dfrn_confirm_post($a, $handsfree);
}

View file

@ -211,13 +211,14 @@ function display_content(App $a, $update = false, $update_uid = 0) {
if ($update) {
$item_id = $_REQUEST['item_id'];
$item = dba::selectFirst('item', ['uid', 'parent'], ['id' => $item_id]);
$item = dba::selectFirst('item', ['uid', 'parent', 'parent-uri'], ['id' => $item_id]);
if ($item['uid'] != 0) {
$a->profile = ['uid' => intval($item['uid']), 'profile_uid' => intval($item['uid'])];
} else {
$a->profile = ['uid' => intval($update_uid), 'profile_uid' => intval($update_uid)];
}
$item_parent = $item['parent'];
$item_parent_uri = $item['parent-uri'];
} else {
$item_id = (($a->argc > 2) ? $a->argv[2] : 0);
@ -225,23 +226,25 @@ function display_content(App $a, $update = false, $update_uid = 0) {
$item_parent = 0;
if (local_user()) {
$r = dba::fetch_first("SELECT `id`, `parent` FROM `item`
$r = dba::fetch_first("SELECT `id`, `parent`, `parent-uri` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND `guid` = ? AND `uid` = ?", $a->argv[1], local_user());
if (DBM::is_result($r)) {
$item_id = $r["id"];
$item_parent = $r["parent"];
$item_parent_uri = $r['parent-uri'];
}
}
if ($item_parent == 0) {
$r = dba::fetch_first("SELECT `item`.`id`, `item`.`parent` FROM `item`
$r = dba::fetch_first("SELECT `item`.`id`, `item`.`parent`, `item`.`parent-uri` FROM `item`
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
AND NOT `item`.`private` AND `item`.`uid` = 0
AND `item`.`guid` = ?", $a->argv[1]);
if (DBM::is_result($r)) {
$item_id = $r["id"];
$item_parent = $r["parent"];
$item_parent_uri = $r['parent-uri'];
}
}
}
@ -332,22 +335,21 @@ function display_content(App $a, $update = false, $update_uid = 0) {
$sql_extra = item_permissions_sql($a->profile['uid'], $remote_contact, $groups);
if ($update) {
$r = dba::p("SELECT `id` FROM `item` WHERE
`item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
$sql_extra AND `unseen`",
$item_id
);
if (local_user() && (local_user() == $a->profile['uid'])) {
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
$unseen = dba::exists('item', $condition);
} else {
$unseen = false;
}
if (dba::num_rows($r) == 0) {
if ($update && !$unseen) {
return '';
}
}
$r = dba::p(item_query()."AND `item`.`parent` = (SELECT `parent` FROM `item` WHERE `id` = ?)
$sql_extra
ORDER BY `parent` DESC, `gravity` ASC, `id` ASC",
$item_id
$r = dba::p(item_query(local_user())."AND `item`.`parent-uri` = (SELECT `parent-uri` FROM `item` WHERE `id` = ?)
AND `item`.`uid` IN (0, ?) $sql_extra
ORDER BY `item`.`uid` ASC, `parent` DESC, `gravity` ASC, `id` ASC",
$item_id, local_user()
);
if (!DBM::is_result($r)) {
@ -357,11 +359,9 @@ function display_content(App $a, $update = false, $update_uid = 0) {
$s = dba::inArray($r);
if (local_user() && (local_user() == $a->profile['uid'])) {
$unseen = dba::selectFirst('item', ['id'], ['parent' => $s[0]['parent'], 'unseen' => true]);
if (DBM::is_result($unseen)) {
dba::update('item', ['unseen' => false], ['parent' => $s[0]['parent'], 'unseen' => true]);
}
if ($unseen) {
$condition = ['parent-uri' => $item_parent_uri, 'uid' => local_user(), 'unseen' => true];
dba::update('item', ['unseen' => false], $condition);
}
$items = conv_sort($s, "`commented`");
@ -369,7 +369,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
if (!$update) {
$o .= "<script> var netargs = '?f=&item_id=" . $item_id . "'; </script>";
}
$o .= conversation($a, $items, 'display', $update_uid);
$o .= conversation($a, $items, 'display', $update_uid, false, 'commented', local_user());
// Preparing the meta header
$description = trim(HTML::toPlaintext(BBCode::convert($s[0]["body"], false), 0, true));

View file

@ -546,7 +546,7 @@ function events_content(App $a) {
// Delete only real events (no birthdays)
if (DBM::is_result($ev) && $ev[0]['type'] == 'event') {
$del = Item::deleteById($ev[0]['itemid']);
$del = Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
}
if ($del == 0) {

View file

@ -226,7 +226,7 @@ function group_content(App $a) {
$entry['label'] = 'members';
$entry['photo_menu'] = '';
$entry['change_member'] = [
'title' => L10n::t("Remove Contact"),
'title' => L10n::t("Remove contact from group"),
'gid' => $group['id'],
'cid' => $member['id'],
'sec_token' => $sec_token
@ -250,7 +250,7 @@ function group_content(App $a) {
$entry['label'] = 'contacts';
$entry['photo_menu'] = '';
$entry['change_member'] = [
'title' => L10n::t("Add Contact"),
'title' => L10n::t("Add contact to group"),
'gid' => $group['id'],
'cid' => $member['id'],
'sec_token' => $sec_token

View file

@ -661,6 +661,11 @@ function item_post(App $a) {
$datarray['edit'] = true;
}
// Check for hashtags in the body and repair or add hashtag links
if ($preview || $orig_post) {
Item::setHashtags($datarray);
}
// preview mode - prepare the body for display and send it via json
if ($preview) {
require_once 'include/conversation.php';
@ -872,7 +877,7 @@ function item_content(App $a) {
$o = '';
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
if (is_ajax()) {
$o = Item::deleteById($a->argv[2]);
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
} else {
$o = drop_item($a->argv[2]);
}

View file

@ -345,7 +345,7 @@ function networkConversation($a, $items, $mode, $update, $ordering = '')
// Set this so that the conversation function can find out contact info for our wall-wall items
$a->page_contact = $a->contact;
$o = conversation($a, $items, $mode, $update, false, $ordering);
$o = conversation($a, $items, $mode, $update, false, $ordering, local_user());
if (!$update) {
if (PConfig::get(local_user(), 'system', 'infinite_scroll')) {
@ -456,8 +456,8 @@ function networkFlatView(App $a, $update = 0)
$items = q("SELECT %s FROM `item` $sql_post_table %s
WHERE %s AND `item`.`uid` = %d
ORDER BY `item`.`id` DESC $pager_sql ",
item_fieldlists(), item_joins(), item_condition(),
intval($_SESSION['uid'])
item_fieldlists(), item_joins(local_user()), item_condition(),
intval(local_user())
);
$condition = ['unseen' => true, 'uid' => local_user()];
@ -610,7 +610,7 @@ function networkThreadedView(App $a, $update, $parent)
$sql_tag_nets = (($nets) ? sprintf(" AND `item`.`network` = '%s' ", dbesc($nets)) : '');
if ($gid) {
$group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => $_SESSION['uid']]);
$group = dba::selectFirst('group', ['name'], ['id' => $gid, 'uid' => local_user()]);
if (!DBM::is_result($group)) {
if ($update) {
killme();
@ -626,7 +626,7 @@ function networkThreadedView(App $a, $update, $parent)
$contact_str_self = '';
$contact_str = implode(',', $contacts);
$self = dba::selectFirst('contact', ['id'], ['uid' => $_SESSION['uid'], 'self' => true]);
$self = dba::selectFirst('contact', ['id'], ['uid' => local_user(), 'self' => true]);
if (DBM::is_result($self)) {
$contact_str_self = $self['id'];
}
@ -774,12 +774,15 @@ function networkThreadedView(App $a, $update, $parent)
AND (`item`.`parent-uri` != `item`.`uri`
OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
WHERE `item`.`uid` = %d AND `item`.`visible` AND NOT `item`.`deleted`
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
AND NOT `item`.`moderated` AND $sql_extra4
$sql_extra3 $sql_extra $sql_range $sql_nets
ORDER BY `order_date` DESC LIMIT 100",
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND),
intval(local_user()),
intval(local_user())
);
} else {
@ -791,12 +794,15 @@ function networkThreadedView(App $a, $update, $parent)
AND (`item`.`parent-uri` != `item`.`uri`
OR `contact`.`uid` = `item`.`uid` AND `contact`.`self`
OR `contact`.`rel` IN (%d, %d) AND NOT `contact`.`readonly`)
LEFT JOIN `user-item` ON `user-item`.`iid` = `item`.`id` AND `user-item`.`uid` = %d
WHERE `thread`.`uid` = %d AND `thread`.`visible` AND NOT `thread`.`deleted`
AND NOT `thread`.`moderated`
AND (`user-item`.`hidden` IS NULL OR NOT `user-item`.`hidden`)
$sql_extra2 $sql_extra3 $sql_range $sql_extra $sql_nets
ORDER BY `order_date` DESC $pager_sql",
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND),
intval(local_user()),
intval(local_user())
);
}

View file

@ -10,6 +10,7 @@ use Friendica\Core\Addon;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Util\Network;
require_once 'include/dba.php';
function nodeinfo_wellknown(App $a) {
$nodeinfo = ['links' => [['rel' => 'http://nodeinfo.diaspora.software/ns/schema/1.0',
@ -153,7 +154,7 @@ function nodeinfo_cron() {
$a = get_app();
// If the addon 'statistics_json' is enabled then disable it and actrivate nodeinfo.
// If the addon 'statistics_json' is enabled then disable it and activate nodeinfo.
if (Addon::isEnabled('statistics_json')) {
Config::set('system', 'nodeinfo', true);
@ -176,16 +177,7 @@ function nodeinfo_cron() {
if (!Config::get('system', 'nodeinfo')) {
return;
}
$last = Config::get('nodeinfo', 'last_calucation');
if ($last) {
// Calculate every 24 hours
$next = $last + (24 * 60 * 60);
if ($next > time()) {
logger('calculation intervall not reached');
return;
}
}
logger('cron_start');
$users = q("SELECT `user`.`uid`, `user`.`login_date`, `contact`.`last-item`
@ -214,35 +206,19 @@ function nodeinfo_cron() {
}
}
Config::set('nodeinfo', 'total_users', $total_users);
logger('total_users: '.$total_users, LOGGER_DEBUG);
Config::set('nodeinfo', 'active_users_halfyear', $active_users_halfyear);
Config::set('nodeinfo', 'active_users_monthly', $active_users_monthly);
logger('total_users: ' . $total_users . '/' . $active_users_halfyear. '/' . $active_users_monthly, LOGGER_DEBUG);
}
$posts = q("SELECT COUNT(*) AS `local_posts` FROM `thread` WHERE `thread`.`wall` AND `thread`.`uid` != 0");
if (!is_array($posts)) {
$local_posts = -1;
} else {
$local_posts = $posts[0]['local_posts'];
}
$local_posts = dba::count('thread', ["`wall` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_posts', $local_posts);
logger('local_posts: ' . $local_posts, LOGGER_DEBUG);
logger('local_posts: '.$local_posts, LOGGER_DEBUG);
$posts = q("SELECT COUNT(*) AS `local_comments` FROM `contact`
INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id` AND `item`.`uid` = `contact`.`uid` AND
`item`.`id` != `item`.`parent` AND `item`.`network` IN ('%s', '%s', '%s')
WHERE `contact`.`self`",
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));
if (!is_array($posts)) {
$local_comments = -1;
} else {
$local_comments = $posts[0]['local_comments'];
}
$local_comments = dba::count('item', ["`origin` AND `id` != `parent` AND NOT `deleted` AND `uid` != 0"]);
Config::set('nodeinfo', 'local_comments', $local_comments);
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
// Now trying to register
$url = 'http://the-federation.info/register/'.$a->get_hostname();
@ -251,5 +227,4 @@ function nodeinfo_cron() {
logger('registering answer: '.$ret, LOGGER_DEBUG);
logger('cron_end');
Config::set('nodeinfo', 'last_calucation', time());
}

View file

@ -82,7 +82,7 @@ function notes_content(App $a, $update = false)
WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
$sql_extra ",
item_joins(),
item_joins(local_user()),
item_condition(),
intval(local_user())
);
@ -97,7 +97,7 @@ function notes_content(App $a, $update = false)
AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
$sql_extra
ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
item_joins(),
item_joins(local_user()),
item_condition(),
intval(local_user()),
intval($a->pager['start']),
@ -119,7 +119,7 @@ function notes_content(App $a, $update = false)
$sql_extra
ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
item_fieldlists(),
item_joins(),
item_joins(local_user()),
item_condition(),
intval(local_user()),
dbesc($parents_str)

View file

@ -173,7 +173,6 @@ function notifications_content(App $a) {
'$fullname' => $it['name'],
'$url' => $it['url'],
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
'$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')],
'$knowyou' => $it['knowyou'],
'$approve' => L10n::t('Approve'),
@ -252,7 +251,6 @@ function notifications_content(App $a) {
'$gender' => $it['gender'],
'$lbl_gender' => L10n::t('Gender:'),
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
'$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')],
'$url' => $it['url'],
'$zrl' => $it['zrl'],
'$lbl_url' => L10n::t('Profile URL'),

View file

@ -19,7 +19,7 @@ function openid_content(App $a) {
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
$openid = new LightOpenID;
$openid = new LightOpenID($a->get_hostname());
if($openid->validate()) {

View file

@ -284,14 +284,7 @@ function photos_post(App $a)
);
// find and delete the corresponding item with all the comments and likes/dislikes
$r = q("SELECT `id` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid)
);
if (DBM::is_result($r)) {
foreach ($r as $rr) {
Item::deleteById($rr['id']);
}
}
Item::deleteForUser(['resource-id' => $res, 'uid' => $page_owner_uid], $page_owner_uid);
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
@ -344,17 +337,12 @@ function photos_post(App $a)
intval($page_owner_uid),
dbesc($r[0]['resource-id'])
);
$i = q("SELECT `id` FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($r[0]['resource-id']),
intval($page_owner_uid)
);
if (DBM::is_result($i)) {
Item::deleteById($i[0]['id']);
Item::deleteForUser(['resource-id' => $r[0]['resource-id'], 'uid' => $page_owner_uid], $page_owner_uid);
// Update the photo albums cache
Photo::clearAlbumCache($page_owner_uid);
}
}
goaway('photos/' . $a->data['user']['nickname']);
return; // NOTREACHED

View file

@ -75,6 +75,7 @@ function profile_init(App $a)
}
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which . '" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
@ -338,7 +339,7 @@ function profile_content(App $a, $update = 0)
$parents_str = implode(', ', $parents_arr);
$items = q(item_query() . " AND `item`.`uid` = %d
$items = q(item_query($a->profile['profile_uid']) . " AND `item`.`uid` = %d
AND `item`.`parent` IN (%s)
$sql_extra ",
intval($a->profile['profile_uid']),
@ -364,7 +365,7 @@ function profile_content(App $a, $update = 0)
}
}
$o .= conversation($a, $items, 'profile', $update);
$o .= conversation($a, $items, 'profile', $update, false, 'commented', local_user());
if (!$update) {
$o .= alt_pager($a, count($items));

View file

@ -403,9 +403,6 @@ function profiles_post(App $a) {
$comma2 = (($region && $country_name) ? ', ' : '');
$value = $locality . $comma1 . $region . $comma2 . $country_name;
}
profile_activity($changes,$value);
}
$r = q("UPDATE `profile`
@ -510,96 +507,6 @@ function profiles_post(App $a) {
}
}
function profile_activity($changed, $value) {
$a = get_app();
if (! local_user() || ! is_array($changed) || ! count($changed)) {
return;
}
if ($a->user['hidewall'] || Config::get('system', 'block_public')) {
return;
}
if (! PConfig::get(local_user(), 'system', 'post_profilechange')) {
return;
}
require_once 'include/items.php';
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
intval(local_user())
);
if (! DBM::is_result($self)) {
return;
}
$arr = [];
$arr['guid'] = get_guid(32);
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user());
$arr['uid'] = local_user();
$arr['contact-id'] = $self[0]['id'];
$arr['wall'] = 1;
$arr['type'] = 'wall';
$arr['gravity'] = 0;
$arr['origin'] = 1;
$arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
$arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
$arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
$arr['verb'] = ACTIVITY_UPDATE;
$arr['object-type'] = ACTIVITY_OBJ_PROFILE;
$A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
$changes = '';
$t = count($changed);
$z = 0;
foreach ($changed as $ch) {
if (strlen($changes)) {
if ($z == ($t - 1)) {
$changes .= L10n::t(' and ');
} else {
$changes .= ', ';
}
}
$z ++;
$changes .= $ch;
}
$prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . L10n::t('public profile') . '[/url]';
if ($t == 1 && strlen($value)) {
$message = L10n::t('%1$s changed %2$s to &ldquo;%3$s&rdquo;', $A, $changes, $value);
$message .= "\n\n" . L10n::t(' - Visit %1$s\'s %2$s', $A, $prof);
} else {
$message = L10n::t('%1$s has an updated %2$s, changing %3$s.', $A, $prof, $changes);
}
$arr['body'] = $message;
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PROFILE . '</type><title>' . $self[0]['name'] . '</title>'
. '<id>' . $self[0]['url'] . '/' . $self[0]['name'] . '</id>';
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n");
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n");
$arr['object'] .= '</link></object>' . "\n";
$arr['allow_cid'] = $a->user['allow_cid'];
$arr['allow_gid'] = $a->user['allow_gid'];
$arr['deny_cid'] = $a->user['deny_cid'];
$arr['deny_gid'] = $a->user['deny_gid'];
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
}
function profiles_content(App $a) {
if (! local_user()) {

View file

@ -4,8 +4,8 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
use Friendica\Model\PushSubscriber;
function post_var($name) {
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
@ -42,12 +42,11 @@ function pubsubhubbub_init(App $a) {
} elseif ($hub_mode === 'unsubscribe') {
$subscribe = 0;
} else {
logger("pubsubhubbub: invalid hub_mode=$hub_mode, ignoring.");
logger("Invalid hub_mode=$hub_mode, ignoring.");
System::httpExit(404);
}
logger("pubsubhubbub: $hub_mode request from " .
$_SERVER['REMOTE_ADDR']);
logger("$hub_mode request from " . $_SERVER['REMOTE_ADDR']);
// get the nick name from the topic, a bit hacky but needed as a fallback
$nick = substr(strrchr($hub_topic, "/"), 1);
@ -58,44 +57,37 @@ function pubsubhubbub_init(App $a) {
}
if (!$nick) {
logger('pubsubhubbub: bad hub_topic=$hub_topic, ignoring.');
logger('Bad hub_topic=$hub_topic, ignoring.');
System::httpExit(404);
}
// fetch user from database given the nickname
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s'" .
" AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick));
if (!DBM::is_result($r)) {
logger('pubsubhubbub: local account not found: ' . $nick);
$condition = ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false];
$owner = dba::selectFirst('user', ['uid', 'hidewall'], $condition);
if (!DBM::is_result($owner)) {
logger('Local account not found: ' . $nick . ' - topic: ' . $hub_topic . ' - callback: ' . $hub_callback);
System::httpExit(404);
}
$owner = $r[0];
// abort if user's wall is supposed to be private
if ($r[0]['hidewall']) {
logger('pubsubhubbub: local user ' . $nick .
'has chosen to hide wall, ignoring.');
if ($owner['hidewall']) {
logger('Local user ' . $nick . 'has chosen to hide wall, ignoring.');
System::httpExit(403);
}
// get corresponding row from contact table
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked`".
" AND NOT `pending` AND `self` LIMIT 1",
intval($owner['uid']));
if (!DBM::is_result($r)) {
logger('pubsubhubbub: contact not found.');
$condition = ['uid' => $owner['uid'], 'blocked' => false,
'pending' => false, 'self' => true];
$contact = dba::selectFirst('contact', ['poll'], $condition);
if (!DBM::is_result($contact)) {
logger('Self contact for user ' . $owner['uid'] . ' not found.');
System::httpExit(404);
}
$contact = $r[0];
// sanity check that topic URLs are the same
if (!link_compare($hub_topic, $contact['poll'])) {
logger('pubsubhubbub: hub topic ' . $hub_topic . ' != ' .
$contact['poll']);
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
if (!link_compare($hub_topic, $contact['poll']) && !link_compare($hub_topic2, $contact['poll'])) {
logger('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);
System::httpExit(404);
}
@ -117,55 +109,20 @@ function pubsubhubbub_init(App $a) {
// give up if the HTTP return code wasn't a success (2xx)
if ($ret < 200 || $ret > 299) {
logger("pubsubhubbub: subscriber verification at $hub_callback ".
"returned $ret, ignoring.");
logger("Subscriber verification for $hub_topic at $hub_callback returned $ret, ignoring.");
System::httpExit(404);
}
// check that the correct hub_challenge code was echoed back
if (trim($body) !== $hub_challenge) {
logger("pubsubhubbub: subscriber did not echo back ".
"hub.challenge, ignoring.");
logger("Subscriber did not echo back hub.challenge, ignoring.");
logger("\"$hub_challenge\" != \"".trim($body)."\"");
System::httpExit(404);
}
// fetch the old subscription if it exists
$r = q("SELECT * FROM `push_subscriber` WHERE `callback_url` = '%s'",
dbesc($hub_callback));
PushSubscriber::renew($owner['uid'], $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret);
// delete old subscription if it exists
dba::delete('push_subscriber', ['callback_url' => $hub_callback]);
if ($subscribe) {
$last_update = DateTimeFormat::utcNow();
$push_flag = 0;
// if we are just updating an old subscription, keep the
// old values for push and last_update
if (DBM::is_result($r)) {
$last_update = $r[0]['last_update'];
$push_flag = $r[0]['push'];
}
// subscribe means adding the row to the table
q("INSERT INTO `push_subscriber` (`uid`, `callback_url`, " .
"`topic`, `nickname`, `push`, `last_update`, `secret`) values " .
"(%d, '%s', '%s', '%s', %d, '%s', '%s')",
intval($owner['uid']),
dbesc($hub_callback),
dbesc($hub_topic),
dbesc($nick),
intval($push_flag),
dbesc($last_update),
dbesc($hub_secret));
logger("pubsubhubbub: successfully subscribed [$hub_callback].");
} else {
logger("pubsubhubbub: successfully unsubscribed [$hub_callback].");
// we do nothing here, since the row was already deleted
}
System::httpExit(202);
}
killme();
}

View file

@ -12,6 +12,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Model\User;
use Friendica\Module\Tos;
use Friendica\Util\DateTimeFormat;
require_once 'include/enotify.php';
@ -232,8 +233,8 @@ function register_content(App $a)
$profile_publish = replace_macros($publish_tpl, [
'$instance' => 'reg',
'$pubdesc' => L10n::t('Include your profile in member directory?'),
'$yes_selected' => ' checked="checked" ',
'$no_selected' => '',
'$yes_selected' => '',
'$no_selected' => ' checked="checked"',
'$str_yes' => L10n::t('Yes'),
'$str_no' => L10n::t('No'),
]);
@ -252,6 +253,8 @@ function register_content(App $a)
$tpl = $arr['template'];
$tos = new Tos();
$o = replace_macros($tpl, [
'$oidhtml' => $oidhtml,
'$invitations' => Config::get('system', 'invitation_only'),
@ -286,6 +289,8 @@ function register_content(App $a)
'$importt' => L10n::t('Import your profile to this friendica instance'),
'$showtoslink' => Config::get('system', 'tosdisplay'),
'$tostext' => L10n::t('Terms of Service'),
'$showprivstatement' => Config::get('system', 'tosprivstatement'),
'$privstatement' => $tos->privacy_complete,
'$baseurl' => System::baseurl(),
'$form_security_token' => get_form_security_token("register")
]);

View file

@ -6,6 +6,7 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Model\User;
use Friendica\Database\DBM;
require_once 'include/enotify.php';
@ -33,11 +34,12 @@ function removeme_post(App $a)
// send notification to admins so that they can clean um the backups
// send email to admins
$admin_mail_list = "'" . implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email'])))) . "'";
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
$admin_mail_list
);
foreach ($adminlist as $admin) {
$admin_mails = explode(",", str_replace(" ", "", $a->config['admin_email']));
foreach ($admin_mails as $mail) {
$admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
if (!DBM::is_result($admin)) {
continue;
}
notification([
'type' => SYSTEM_EMAIL,
'subject' => L10n::t('[Friendica System Notify]') . ' ' . L10n::t('User deleted their account'),

View file

@ -204,7 +204,7 @@ function search_content(App $a) {
AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`term` = '%s' AND `item`.`verb` = '%s'
AND NOT `author`.`blocked` AND NOT `author`.`hidden`
ORDER BY term.created DESC LIMIT %d , %d ",
item_fieldlists(), item_joins(), item_condition(),
item_fieldlists(), item_joins(local_user()), item_condition(),
intval(local_user()),
intval(TERM_OBJ_POST), intval(TERM_HASHTAG), dbesc(protect_sprintf($search)), dbesc(ACTIVITY_POST),
intval($a->pager['start']), intval($a->pager['itemspage']));
@ -219,7 +219,7 @@ function search_content(App $a) {
AND NOT `author`.`blocked` AND NOT `author`.`hidden`
$sql_extra
GROUP BY `item`.`uri`, `item`.`id` ORDER BY `item`.`id` DESC LIMIT %d , %d",
item_fieldlists(), item_joins(), item_condition(),
item_fieldlists(), item_joins(local_user()), item_condition(),
intval(local_user()),
intval($a->pager['start']), intval($a->pager['itemspage']));
}
@ -241,7 +241,7 @@ function search_content(App $a) {
]);
logger("Start Conversation for '".$search."'", LOGGER_DEBUG);
$o .= conversation($a,$r,'search',false);
$o .= conversation($a, $r, 'search', false, false, 'commented', local_user());
$o .= alt_pager($a,count($r));

View file

@ -442,9 +442,6 @@ function settings_post(App $a)
$suggestme = ((x($_POST, 'suggestme')) ? intval($_POST['suggestme']) : 0);
$hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0);
$hidewall = (($_POST['hidewall'] == 1) ? 1: 0);
$post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0);
$post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0);
$post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0);
$email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0);
$detailed_notif = (($_POST['detailed_notif'] == 1) ? 1 : 0);
@ -543,7 +540,7 @@ function settings_post(App $a)
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
if (Network::isUrlValid($openid)) {
logger('updating openidserver');
$open_id_obj = new LightOpenID;
$open_id_obj = new LightOpenID($a->get_hostname());
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);
} else {
@ -558,9 +555,6 @@ function settings_post(App $a)
PConfig::set(local_user(), 'expire', 'network_only', $expire_network_only);
PConfig::set(local_user(), 'system', 'suggestme', $suggestme);
PConfig::set(local_user(), 'system', 'post_newfriend', $post_newfriend);
PConfig::set(local_user(), 'system', 'post_joingroup', $post_joingroup);
PConfig::set(local_user(), 'system', 'post_profilechange', $post_profilechange);
PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly);
PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif);
@ -972,7 +966,7 @@ function settings_content(App $a)
'$noinfo' => ['noinfo', L10n::t("Don't show notices"), $noinfo, ''],
'$infinite_scroll' => ['infinite_scroll', L10n::t("Infinite scroll"), $infinite_scroll, ''],
'$no_auto_update' => ['no_auto_update', L10n::t("Automatic updates only at the top of the network page"), $no_auto_update, L10n::t('When disabled, the network page is updated all the time, which could be confusing while reading.')],
'$bandwidth_saver' => ['bandwidth_saver', L10n::t('Bandwith Saver Mode'), $bandwidth_saver, L10n::t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')],
'$bandwidth_saver' => ['bandwidth_saver', L10n::t('Bandwidth Saver Mode'), $bandwidth_saver, L10n::t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')],
'$smart_threading' => ['smart_threading', L10n::t('Smart Threading'), $smart_threading, L10n::t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')],
'$d_tset' => L10n::t('General Theme Settings'),
@ -1020,9 +1014,6 @@ function settings_content(App $a)
$expire_photos = PConfig::get(local_user(), 'expire', 'photos', false);
$expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false);
$suggestme = PConfig::get(local_user(), 'system', 'suggestme', false);
$post_newfriend = PConfig::get(local_user(), 'system', 'post_newfriend', false);
$post_joingroup = PConfig::get(local_user(), 'system', 'post_joingroup', false);
$post_profilechange = PConfig::get(local_user(), 'system', 'post_profilechange', false);
// nowarn_insecure
@ -1100,13 +1091,13 @@ function settings_content(App $a)
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else {
$profile_in_dir = replace_macros($opt_tpl, [
'$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')), [L10n::t('No'), L10n::t('Yes')]]
'$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
]);
}
if (strlen(Config::get('system', 'directory'))) {
$profile_in_net_dir = replace_macros($opt_tpl, [
'$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
'$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], L10n::t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')), [L10n::t('No'), L10n::t('Yes')]]
]);
} else {
$profile_in_net_dir = '';
@ -1117,7 +1108,7 @@ function settings_content(App $a)
]);
$hide_wall = replace_macros($opt_tpl, [
'$field' => ['hidewall', L10n::t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], L10n::t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Disables posting public messages to Diaspora and other networks.'), [L10n::t('No'), L10n::t('Yes')]],
'$field' => ['hidewall', L10n::t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], L10n::t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.'), [L10n::t('No'), L10n::t('Yes')]],
]);
$blockwall = replace_macros($opt_tpl, [
@ -1247,10 +1238,6 @@ function settings_content(App $a)
'$h_not' => L10n::t('Notification Settings'),
'$activity_options' => L10n::t('By default post a status message when:'),
'$post_newfriend' => ['post_newfriend', L10n::t('accepting a friend request'), $post_newfriend, ''],
'$post_joingroup' => ['post_joingroup', L10n::t('joining a forum/community'), $post_joingroup, ''],
'$post_profilechange' => ['post_profilechange', L10n::t('making an <em>interesting</em> profile change'), $post_profilechange, ''],
'$lbl_not' => L10n::t('Send a notification email when:'),
'$notify1' => ['notify1', L10n::t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''],
'$notify2' => ['notify2', L10n::t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''],

View file

@ -23,7 +23,7 @@ function update_community_content(App $a) {
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);

View file

@ -23,7 +23,7 @@ function update_display_content(App $a)
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);

View file

@ -29,7 +29,7 @@ function update_network_content(App $a)
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />" . L10n::t("[Embedded content - reload page to view]") . "<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);

View file

@ -36,7 +36,7 @@ function update_notes_content(App $a) {
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);

View file

@ -35,7 +35,7 @@ function update_profile_content(App $a) {
$replace = "<img\${1} dst=\"\${2}\"";
$text = preg_replace($pattern, $replace, $text);
if (PConfig::get(local_user(), "system", "bandwith_saver")) {
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
$text = preg_replace($pattern, $replace, $text);

View file

@ -169,7 +169,7 @@ function videos_post(App $a) {
);
if (DBM::is_result($i)) {
Item::deleteById($i[0]['id']);
Item::deleteForUser(['id' => $i[0]['id']], local_user());
}
}

View file

@ -82,27 +82,22 @@ server {
# rewrite to front controller as default rule
location / {
if ($is_args != "") {
rewrite ^/(.*) /index.php?pagename=$uri&$args last;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?pagename=$1;
}
rewrite ^/(.*) /index.php?pagename=$uri last;
}
# make sure webfinger and other well known services aren't blocked
# by denying dot files and rewrite request to the front controller
location ^~ /.well-known/ {
allow all;
rewrite ^/(.*) /index.php?pagename=$uri&$args last;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?pagename=$1;
}
}
# statically serve these file types when possible
# otherwise fall back to front controller
# allow browser to cache them
# added .htm for advanced source code editor library
location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {
expires 30d;
try_files $uri /index.php?pagename=$uri&$args;
}
include mime.types;
# block these file types
location ~* \.(tpl|md|tgz|log|out)$ {
@ -126,8 +121,8 @@ server {
# With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
# With php7.0-fpm:
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_index index.php;

View file

@ -9,6 +9,8 @@ use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use dba;
use Detection\MobileDetect;
@ -861,18 +863,6 @@ class App
return;
}
// If the last worker fork was less than 2 seconds before then don't fork another one.
// This should prevent the forking of masses of workers.
$cachekey = 'app:proc_run:started';
$result = Cache::get($cachekey);
if (!is_null($result) && ( time() - $result) < 2) {
return;
}
// Set the timestamp of the last proc_run
Cache::set($cachekey, time(), CACHE_MINUTE);
array_unshift($args, ((x($this->config, 'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php'));
for ($x = 0; $x < count($args); $x ++) {
@ -1103,10 +1093,15 @@ class App
*/
public function getCurrentTheme()
{
if (!$this->current_theme) {
$this->computeCurrentTheme();
if ($this->mode == App::MODE_INSTALL) {
return '';
}
//// @TODO Compute the current theme only once (this behavior has
/// already been implemented, but it didn't work well -
/// https://github.com/friendica/friendica/issues/5092)
$this->computeCurrentTheme();
return $this->current_theme;
}

View file

@ -92,8 +92,8 @@ class Feature
// Network sidebar widgets
'widgets' => [
L10n::t('Network Sidebar Widgets'),
['archives', L10n::t('Search by Date'), L10n::t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)],
L10n::t('Network Sidebar'),
['archives', L10n::t('Archives'), L10n::t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)],
['forumlist_widget', L10n::t('List Forums'), L10n::t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock', 'forumlist_widget', false)],
['groups', L10n::t('Group Filter'), L10n::t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock', 'groups', false)],
['networks', L10n::t('Network Filter'), L10n::t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock', 'networks', false)],

View file

@ -174,6 +174,10 @@ class Nav
$nav['about'] = ['friendica', L10n::t('Information'), '', L10n::t('Information about this friendica instance')];
if (Config::get('system', 'tosdisplay')) {
$nav['tos'] = ['tos', L10n::t('Terms of Service'), '', L10n::t('Terms of Service of this Friendica instance')];
}
// The following nav links are only show to logged in users
if (local_user()) {
$nav['network'] = ['network', L10n::t('Network'), '', L10n::t('Conversations from your friends')];

View file

@ -359,6 +359,16 @@ class BBCode extends BaseObject
return $naked_text;
}
private static function proxyUrl($image, $simplehtml = false)
{
// Only send proxied pictures to API and for internal display
if (in_array($simplehtml, [false, 2])) {
return proxy_url($image);
} else {
return $image;
}
}
public static function scaleExternalImages($srctext, $include_link = true, $scale_replace = false)
{
// Suppress "view full size"
@ -562,13 +572,13 @@ class BBCode extends BaseObject
}
if ($data["image"] != "") {
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], proxy_url($data["image"]), $data["title"]);
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], self::proxyUrl($data["image"], $simplehtml), $data["title"]);
} elseif ($data["preview"] != "") {
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], self::proxyUrl($data["preview"], $simplehtml), $data["title"]);
}
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
$return .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], self::proxyUrl($data["image"], $simplehtml), $data["title"]);
} else {
$return .= sprintf('<h4><a href="%s">%s</a></h4>', $data['url'], $data['title']);
}
@ -839,7 +849,7 @@ class BBCode extends BaseObject
// it loops over the array starting from the first element and going sequentially
// to the last element
$newbody = str_replace('[$#saved_image' . $cnt . '#$]',
'<img src="' . proxy_url($image) . '" alt="' . L10n::t('Image/photo') . '" />', $newbody);
'<img src="' . self::proxyUrl($image) . '" alt="' . L10n::t('Image/photo') . '" />', $newbody);
$cnt++;
}
@ -1571,12 +1581,12 @@ class BBCode extends BaseObject
// [img=widthxheight]image source[/img]
$text = preg_replace_callback(
"/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/ism",
function ($matches) {
function ($matches) use ($simple_html) {
if (strpos($matches[3], "data:image/") === 0) {
return $matches[0];
}
$matches[3] = proxy_url($matches[3]);
$matches[3] = self::proxyUrl($matches[3], $simple_html);
return "[img=" . $matches[1] . "x" . $matches[2] . "]" . $matches[3] . "[/img]";
},
$text
@ -1586,8 +1596,8 @@ class BBCode extends BaseObject
$text = preg_replace("/\[zmg\=([0-9]*)x([0-9]*)\](.*?)\[\/zmg\]/ism", '<img class="zrl" src="$3" style="width: $1px;" >', $text);
$text = preg_replace_callback("/\[img\=([$URLSearchString]*)\](.*?)\[\/img\]/ism",
function ($matches) {
$matches[1] = proxy_url($matches[1]);
function ($matches) use ($simple_html) {
$matches[1] = self::proxyUrl($matches[1], $simple_html);
$matches[2] = htmlspecialchars($matches[2], ENT_COMPAT);
return '<img src="' . $matches[1] . '" alt="' . $matches[2] . '">';
},
@ -1597,12 +1607,12 @@ class BBCode extends BaseObject
// [img]pathtoimage[/img]
$text = preg_replace_callback(
"/\[img\](.*?)\[\/img\]/ism",
function ($matches) {
function ($matches) use ($simple_html) {
if (strpos($matches[1], "data:image/") === 0) {
return $matches[0];
}
$matches[1] = proxy_url($matches[1]);
$matches[1] = self::proxyUrl($matches[1], $simple_html);
return "[img]" . $matches[1] . "[/img]";
},
$text

View file

@ -6,6 +6,7 @@ use Asika\SimpleConsole\Console;
use dba;
use Friendica\App;
use Friendica\Core\Install;
use Friendica\Core\Theme;
require_once 'mod/install.php';
require_once 'include/dba.php';
@ -90,6 +91,15 @@ HELP;
$this->out(" Complete!\n\n");
// Install theme
$this->out("Installing theme\n");
if (!empty($a->config['system']['theme'])) {
Theme::install($a->config['system']['theme']);
$this->out(" Complete\n\n");
} else {
$this->out(" Theme setting is empty. Please check the file htconfig.php\n\n");
}
// Copy config file
$this->out("Saving config file...\n");
if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) {

View file

@ -94,6 +94,7 @@ HELP;
$fnname = 'string_plural_select_' . $lang;
$out .= 'if(! function_exists("' . $fnname . '")) {' . "\n";
$out .= 'function ' . $fnname . '($n){' . "\n";
$out .= ' $n = intval($n);' . "\n";
$out .= ' return ' . $cond . ';' . "\n";
$out .= '}}' . "\n";
}

View file

@ -999,6 +999,7 @@ class Worker
}
/**
* @brief Spawns a new worker
* @return void
*/
public static function spawnWorker()

View file

@ -207,7 +207,7 @@ class DBStructure
public static function update($verbose, $action, $install = false, array $tables = null, array $definition = null) {
if ($action && !$install) {
Config::set('system', 'maintenance', 1);
Config::set('system', 'maintenance_reason', L10n::t(': Database update', DBM::date().' '.date('e')));
Config::set('system', 'maintenance_reason', L10n::t('%s: Database update', DBM::date().' '.date('e')));
}
$errors = '';
@ -1553,12 +1553,15 @@ class DBStructure
"callback_url" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
"push" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => ""],
"last_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => ""],
"push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
"last_update" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last successful trial"],
"next_try" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Next retrial date"],
"renewed" => ["type" => "datetime", "not null" => "1", "default" => NULL_DATE, "comment" => "Date of last subscription renewal"],
"secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
],
"indexes" => [
"PRIMARY" => ["id"],
"next_try" => ["next_try"],
]
];
$database["queue"] = [
@ -1783,6 +1786,17 @@ class DBStructure
"username" => ["username(32)"],
]
];
$database["user-item"] = [
"comment" => "User specific item data",
"fields" => [
"iid" => ["type" => "int unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["item" => "id"], "comment" => "Item id"],
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "primary" => "1", "relation" => ["user" => "uid"], "comment" => "User id"],
"hidden" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Marker to hide an item from the user"],
],
"indexes" => [
"PRIMARY" => ["uid", "iid"],
]
];
$database["workerqueue"] = [
"comment" => "Background tasks queue entries",
"fields" => [
@ -1799,7 +1813,7 @@ class DBStructure
"pid" => ["pid"],
"parameter" => ["parameter(64)"],
"priority_created" => ["priority", "created"],
"executed" => ["executed"],
"done_executed" => ["done", "executed"],
]
];

View file

@ -120,7 +120,8 @@ class PostUpdate
logger("Start", LOGGER_DEBUG);
// Check if the first step is done (Setting "author-id" and "owner-id" in the item table)
$r = dba::select('item', ['author-link', 'owner-link', 'uid'], ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
$fields = ['author-link', 'author-name', 'author-avatar', 'owner-link', 'owner-name', 'owner-avatar', 'network', 'uid'];
$r = dba::select('item', $fields, ['author-id' => 0, 'owner-id' => 0], ['limit' => 1000]);
if (!$r) {
// Are there unfinished entries in the thread table?
$r = q("SELECT COUNT(*) AS `total` FROM `thread`
@ -162,8 +163,13 @@ class PostUpdate
// Set the "author-id" and "owner-id" in the item table and add a new public contact entry if needed
foreach ($item_arr as $item) {
$author_id = Contact::getIdForURL($item["author-link"]);
$owner_id = Contact::getIdForURL($item["owner-link"]);
$default = ['url' => $item['author-link'], 'name' => $item['author-name'],
'photo' => $item['author-avatar'], 'network' => $item['network']];
$author_id = Contact::getIdForURL($item["author-link"], 0, false, $default);
$default = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
'photo' => $item['owner-avatar'], 'network' => $item['network']];
$owner_id = Contact::getIdForURL($item["owner-link"], 0, false, $default);
if ($author_id == 0) {
$author_id = -1;

View file

@ -206,6 +206,16 @@ class Contact extends BaseObject
$fields['forum'] = $user['page-flags'] == PAGE_COMMUNITY;
$fields['prv'] = $user['page-flags'] == PAGE_PRVGROUP;
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
$fields['url'] = System::baseUrl() . '/profile/' . $user['nickname'];
$fields['nurl'] = normalise_link($fields['url']);
$fields['addr'] = $user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
$fields['request'] = System::baseUrl() . '/dfrn_request/' . $user['nickname'];
$fields['notify'] = System::baseUrl() . '/dfrn_notify/' . $user['nickname'];
$fields['poll'] = System::baseUrl() . '/dfrn_poll/' . $user['nickname'];
$fields['confirm'] = System::baseUrl() . '/dfrn_confirm/' . $user['nickname'];
$fields['poco'] = System::baseUrl() . '/poco/' . $user['nickname'];
$update = false;
foreach ($fields as $field => $content) {
@ -752,10 +762,11 @@ class Contact extends BaseObject
* @param string $url Contact URL
* @param integer $uid The user id for the contact (0 = public contact)
* @param boolean $no_update Don't update the contact
* @param array $default Default value for creating the contact when every else fails
*
* @return integer Contact ID
*/
public static function getIdForURL($url, $uid = 0, $no_update = false)
public static function getIdForURL($url, $uid = 0, $no_update = false, $default = [])
{
logger("Get contact data for url " . $url . " and user " . $uid . " - " . System::callstack(), LOGGER_DEBUG);
@ -804,18 +815,48 @@ class Contact extends BaseObject
$data = Probe::uri($url, "", $uid);
// Last try in gcontact for unsupported networks
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_PUMPIO, NETWORK_MAIL])) {
if (!in_array($data["network"], [NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_PUMPIO, NETWORK_MAIL, NETWORK_FEED])) {
if ($uid != 0) {
return 0;
}
// Get data from the gcontact table
$gcontact = dba::selectFirst('gcontact', ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'], ['nurl' => normalise_link($url)]);
if (!DBM::is_result($gcontact)) {
return 0;
$fields = ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'];
$contact = dba::selectFirst('gcontact', $fields, ['nurl' => normalise_link($url)]);
if (!DBM::is_result($contact)) {
$contact = dba::selectFirst('contact', $fields, ['nurl' => normalise_link($url)]);
}
$data = array_merge($data, $gcontact);
if (!DBM::is_result($contact)) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'keywords', 'location', 'about', 'network',
'priority', 'batch', 'request', 'confirm', 'poco'];
$contact = dba::selectFirst('contact', $fields, ['addr' => $url]);
}
if (!DBM::is_result($contact)) {
// The link could be provided as http although we stored it as https
$ssl_url = str_replace('http://', 'https://', $url);
$condition = ['alias' => [$url, normalise_link($url), $ssl_url]];
$contact = dba::selectFirst('contact', $fields, $condition);
}
if (!DBM::is_result($contact)) {
$fields = ['url', 'addr', 'alias', 'notify', 'poll', 'name', 'nick',
'photo', 'network', 'priority', 'batch', 'request', 'confirm'];
$condition = ['url' => [$url, normalise_link($url), $ssl_url]];
$contact = dba::selectFirst('fcontact', $fields, $condition);
}
if (!empty($default)) {
$contact = $default;
}
if (!DBM::is_result($contact)) {
return 0;
} else {
$data = array_merge($data, $contact);
}
}
if (!$contact_id && ($data["alias"] != '') && ($data["alias"] != $url)) {
@ -1008,7 +1049,7 @@ class Contact extends BaseObject
$contact = ($r[0]["contact-type"] == ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
$r = q(item_query() . " AND `item`.`" . $contact . "` = %d AND " . $sql .
$r = q(item_query(local_user()) . " AND `item`.`" . $contact . "` = %d AND " . $sql .
" AND `item`.`verb` = '%s' ORDER BY `item`.`created` DESC LIMIT %d, %d",
intval($author_id), intval(local_user()), dbesc(ACTIVITY_POST),
intval($a->pager['start']), intval($a->pager['itemspage'])
@ -1263,7 +1304,7 @@ class Contact extends BaseObject
if (($network != '') && ($ret['network'] != $network)) {
logger('Expected network ' . $network . ' does not match actual network ' . $ret['network']);
return result;
return $result;
}
// check if we already have a contact

View file

@ -239,7 +239,7 @@ class GContact
if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
// Delete the old entry - if it exists
if (dba::exists('item', ['nurl' => normalise_link($orig_profile)])) {
if (dba::exists('gcontact', ['nurl' => normalise_link($orig_profile)])) {
dba::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
}
}

View file

@ -52,28 +52,38 @@ class Item extends BaseObject
return false;
}
// To ensure the data integrity we do it in an transaction
dba::transaction();
// We cannot simply expand the condition to check for origin entries
// The condition needn't to be a simple array but could be a complex condition.
// And we have to execute this query before the update to ensure to fetch the same data.
$items = dba::select('item', ['id', 'origin'], $condition);
$success = dba::update('item', $fields, $condition);
if (!$success) {
dba::close($items);
dba::rollback();
return false;
}
$rows = dba::affected_rows();
// We cannot simply expand the condition to check for origin entries
// The condition needn't to be a simple array but could be a complex condition.
$items = dba::select('item', ['id', 'origin'], $condition);
while ($item = dba::fetch($items)) {
Term::insertFromTagFieldByItemId($item['id']);
Term::insertFromFileFieldByItemId($item['id']);
self::updateThread($item['id']);
// We only need to notfiy others when it is an original entry from us
if ($item['origin']) {
// We only need to notfiy others when it is an original entry from us.
// Only call the notifier when the item has some content relevant change.
if ($item['origin'] && in_array('edited', array_keys($fields))) {
Worker::add(PRIORITY_HIGH, "Notifier", 'edit_post', $item['id']);
}
}
dba::close($items);
dba::commit();
return $rows;
}
@ -92,6 +102,32 @@ class Item extends BaseObject
dba::close($items);
}
/**
* @brief Delete an item for an user and notify others about it - if it was ours
*
* @param array $condition The condition for finding the item entries
* @param integer $uid User who wants to delete this item
*/
public static function deleteForUser($condition, $uid)
{
if ($uid == 0) {
return;
}
$items = dba::select('item', ['id', 'uid'], $condition);
while ($item = dba::fetch($items)) {
// "Deleting" global items just means hiding them
if ($item['uid'] == 0) {
dba::update('user-item', ['hidden' => true], ['iid' => $item['id'], 'uid' => $uid], true);
} elseif ($item['uid'] == $uid) {
self::deleteById($item['id'], PRIORITY_HIGH);
} else {
logger('Wrong ownership. Not deleting item ' . $item['id']);
}
}
dba::close($items);
}
/**
* @brief Delete an item and notify others about it - if it was ours
*
@ -100,18 +136,20 @@ class Item extends BaseObject
*
* @return boolean success
*/
public static function deleteById($item_id, $priority = PRIORITY_HIGH)
private static function deleteById($item_id, $priority = PRIORITY_HIGH)
{
// locate item to be deleted
$fields = ['id', 'uid', 'parent', 'parent-uri', 'origin', 'deleted',
'file', 'resource-id', 'event-id', 'attach',
$fields = ['id', 'uri', 'uid', 'parent', 'parent-uri', 'origin',
'deleted', 'file', 'resource-id', 'event-id', 'attach',
'verb', 'object-type', 'object', 'target', 'contact-id'];
$item = dba::selectFirst('item', $fields, ['id' => $item_id]);
if (!DBM::is_result($item)) {
logger('Item with ID ' . $item_id . " hasn't been found.", LOGGER_DEBUG);
return false;
}
if ($item['deleted']) {
logger('Item with ID ' . $item_id . ' has already been deleted.', LOGGER_DEBUG);
return false;
}
@ -120,8 +158,6 @@ class Item extends BaseObject
$parent = ['origin' => false];
}
logger('delete item: ' . $item['id'], LOGGER_DEBUG);
// clean up categories and tags so they don't end up as orphans
$matches = false;
@ -174,16 +210,34 @@ class Item extends BaseObject
Term::insertFromFileFieldByItemId($item['id']);
self::deleteThread($item['id'], $item['parent-uri']);
// If it's the parent of a comment thread, kill all the kids
if ($item['id'] == $item['parent']) {
self::delete(['parent' => $item['parent']], $priority);
if (!dba::exists('item', ["`uri` = ? AND `uid` != 0 AND NOT `deleted`", $item['uri']])) {
self::delete(['uri' => $item['uri'], 'uid' => 0, 'deleted' => false], $priority);
}
// send the notification upstream/downstream
if ($item['origin'] || $parent['origin']) {
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
// If it's the parent of a comment thread, kill all the kids
if ($item['id'] == $item['parent']) {
self::delete(['parent' => $item['parent'], 'deleted' => false], $priority);
}
// Is it our comment and/or our thread?
if ($item['origin'] || $parent['origin']) {
// When we delete the original post we will delete all existing copies on the server as well
self::delete(['uri' => $item['uri'], 'deleted' => false], $priority);
// send the notification upstream/downstream
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
} elseif ($item['uid'] != 0) {
// When we delete just our local user copy of an item, we have to set a marker to hide it
$global_item = dba::selectFirst('item', ['id'], ['uri' => $item['uri'], 'uid' => 0, 'deleted' => false]);
if (DBM::is_result($global_item)) {
dba::update('user-item', ['hidden' => true], ['iid' => $global_item['id'], 'uid' => $item['uid']], true);
}
}
logger('Item with ID ' . $item_id . " has been deleted.", LOGGER_DEBUG);
return true;
}
@ -324,6 +378,12 @@ class Item extends BaseObject
$item['origin'] = 1;
$item['network'] = NETWORK_DFRN;
$item['protocol'] = PROTOCOL_DFRN;
if (is_int($notify)) {
$priority = $notify;
} else {
$priority = PRIORITY_HIGH;
}
} else {
$item['network'] = trim(defaults($item, 'network', NETWORK_PHANTOM));
}
@ -346,6 +406,13 @@ class Item extends BaseObject
unset($item['dsprsig']);
}
if (!empty($item['diaspora_signed_text'])) {
$diaspora_signed_text = $item['diaspora_signed_text'];
unset($item['diaspora_signed_text']);
} else {
$diaspora_signed_text = '';
}
// Converting the plink
/// @TODO Check if this is really still needed
if ($item['network'] == NETWORK_OSTATUS) {
@ -479,14 +546,20 @@ class Item extends BaseObject
// The contact-id should be set before "self::insert" was called - but there seems to be issues sometimes
$item["contact-id"] = self::contactId($item);
$item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"]));
$default = ['url' => $item['author-link'], 'name' => $item['author-name'],
'photo' => $item['author-avatar'], 'network' => $item['network']];
$item['author-id'] = defaults($item, 'author-id', Contact::getIdForURL($item["author-link"], 0, false, $default));
if (Contact::isBlocked($item["author-id"])) {
logger('Contact '.$item["author-id"].' is blocked, item '.$item["uri"].' will not be stored');
return 0;
}
$item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"]));
$default = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
'photo' => $item['owner-avatar'], 'network' => $item['network']];
$item['owner-id'] = defaults($item, 'owner-id', Contact::getIdForURL($item["owner-link"], 0, false, $default));
if (Contact::isBlocked($item["owner-id"])) {
logger('Contact '.$item["owner-id"].' is blocked, item '.$item["uri"].' will not be stored');
@ -538,7 +611,7 @@ class Item extends BaseObject
$fields = ['uri', 'parent-uri', 'id', 'deleted',
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
'wall', 'private', 'forum_mode'];
'wall', 'private', 'forum_mode', 'origin'];
$condition = ['uri' => $item['parent-uri'], 'uid' => $item['uid']];
$params = ['order' => ['id' => false]];
$parent = dba::selectFirst('item', $fields, $condition, $params);
@ -790,6 +863,12 @@ class Item extends BaseObject
'signature' => $dsprsig->signature, 'signer' => $dsprsig->signer]);
}
if (!empty($diaspora_signed_text)) {
// Formerly we stored the signed text, the signature and the author in different fields.
// We now store the raw data so that we are more flexible.
dba::insert('sign', ['iid' => $current_post, 'signed_text' => $diaspora_signed_text]);
}
$deleted = self::tagDeliver($item['uid'], $current_post);
/*
@ -833,7 +912,9 @@ class Item extends BaseObject
check_user_notification($current_post);
if ($notify) {
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "Notifier", $notify_type, $current_post);
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", $notify_type, $current_post);
} elseif (!empty($parent) && $parent['origin']) {
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], "Notifier", "comment-import", $current_post);
}
return $current_post;
@ -843,8 +924,9 @@ class Item extends BaseObject
* @brief Distributes public items to the receivers
*
* @param integer $itemid Item ID that should be added
* @param string $signed_text Original text (for Diaspora signatures), JSON encoded.
*/
public static function distribute($itemid)
public static function distribute($itemid, $signed_text = '')
{
$condition = ["`id` IN (SELECT `parent` FROM `item` WHERE `id` = ?)", $itemid];
$parent = dba::selectFirst('item', ['owner-id'], $condition);
@ -879,14 +961,22 @@ class Item extends BaseObject
$users[$contact['uid']] = $contact['uid'];
}
$origin_uid = 0;
if ($item['uri'] != $item['parent-uri']) {
$parents = dba::select('item', ['uid'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
$parents = dba::select('item', ['uid', 'origin'], ["`uri` = ? AND `uid` != 0", $item['parent-uri']]);
while ($parent = dba::fetch($parents)) {
$users[$parent['uid']] = $parent['uid'];
if ($parent['origin'] && !$item['origin']) {
$origin_uid = $parent['uid'];
}
}
}
foreach ($users as $uid) {
if ($origin_uid == $uid) {
$item['diaspora_signed_text'] = $signed_text;
}
self::storeForUser($itemid, $item, $uid);
}
}
@ -1192,7 +1282,7 @@ class Item extends BaseObject
}
}
private static function setHashtags(&$item)
public static function setHashtags(&$item)
{
$tags = get_tags($item["body"]);
@ -2007,7 +2097,7 @@ EOT;
{
$fields = ['uid', 'guid', 'title', 'body', 'created', 'edited', 'commented', 'received', 'changed',
'wall', 'private', 'pubmail', 'moderated', 'visible', 'spam', 'starred', 'bookmark', 'contact-id',
'deleted', 'origin', 'forum_mode', 'network', 'rendered-html', 'rendered-hash'];
'deleted', 'origin', 'forum_mode', 'network', 'author-id', 'owner-id', 'rendered-html', 'rendered-hash'];
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$item = dba::selectFirst('item', $fields, $condition);
@ -2031,7 +2121,7 @@ EOT;
$result = dba::update('thread', $fields, ['iid' => $itemid]);
logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result." ".print_r($item, true), LOGGER_DEBUG);
logger("Update thread for item ".$itemid." - guid ".$item["guid"]." - ".(int)$result, LOGGER_DEBUG);
// Updating a shadow item entry
$items = dba::selectFirst('item', ['id'], ['guid' => $item['guid'], 'uid' => 0]);

View file

@ -90,7 +90,7 @@ class Profile
*/
public static function load(App $a, $nickname, $profile = 0, $profiledata = [], $show_connect = true)
{
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname]);
$user = dba::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
if (!DBM::is_result($user) && empty($profiledata)) {
logger('profile error: ' . $a->query_string, LOGGER_DEBUG);

View file

@ -0,0 +1,154 @@
<?php
/**
* @file src/Model/PushSubscriber.php
*/
namespace Friendica\Model;
use Friendica\Core\Worker;
use Friendica\Util\DateTimeFormat;
use Friendica\Database\DBM;
use dba;
require_once 'include/dba.php';
class PushSubscriber
{
/**
* @brief Send subscription notifications for the given user
*
* @param integer $uid User ID
* @param string $priority Priority for push workers
*/
public static function publishFeed($uid, $default_priority = PRIORITY_HIGH)
{
$condition = ['push' => 0, 'uid' => $uid];
dba::update('push_subscriber', ['push' => 1, 'next_try' => NULL_DATE], $condition);
self::requeue($default_priority);
}
/**
* @brief start workers to transmit the feed data
*
* @param string $priority Priority for push workers
*/
public static function requeue($default_priority = PRIORITY_HIGH)
{
// We'll push to each subscriber that has push > 0,
// i.e. there has been an update (set in notifier.php).
$subscribers = dba::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < UTC_TIMESTAMP()"]);
while ($subscriber = dba::fetch($subscribers)) {
// We always handle retries with low priority
if ($subscriber['push'] > 1) {
$priority = PRIORITY_LOW;
} else {
$priority = $default_priority;
}
logger('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority, LOGGER_DEBUG);
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
}
dba::close($subscribers);
}
/**
* @brief Renew the feed subscription
*
* @param integer $uid User ID
* @param string $nick Priority for push workers
* @param integer $subscribe Subscribe (Unsubscribe = false)
* @param string $hub_callback Callback address
* @param string $hub_topic Feed topic
* @param string $hub_secret Subscription secret
*/
public static function renew($uid, $nick, $subscribe, $hub_callback, $hub_topic, $hub_secret)
{
// fetch the old subscription if it exists
$subscriber = dba::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
// delete old subscription if it exists
dba::delete('push_subscriber', ['callback_url' => $hub_callback]);
if ($subscribe) {
// if we are just updating an old subscription, keep the
// old values for last_update but reset the push
if (DBM::is_result($subscriber)) {
$last_update = $subscriber['last_update'];
$push_flag = min($subscriber['push'], 1);
} else {
$last_update = DateTimeFormat::utcNow();
$push_flag = 0;
}
// subscribe means adding the row to the table
$fields = ['uid' => $uid, 'callback_url' => $hub_callback,
'topic' => $hub_topic, 'nickname' => $nick, 'push' => $push_flag,
'last_update' => $last_update, 'renewed' => DateTimeFormat::utcNow(),
'secret' => $hub_secret];
dba::insert('push_subscriber', $fields);
logger("Successfully subscribed [$hub_callback] for $nick");
} else {
logger("Successfully unsubscribed [$hub_callback] for $nick");
// we do nothing here, since the row was already deleted
}
}
/**
* @brief Delay the push subscriber
*
* @param integer $id Subscriber ID
*/
public static function delay($id)
{
$subscriber = dba::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
if (!DBM::is_result($subscriber)) {
return;
}
$retrial = $subscriber['push'];
if ($retrial > 14) {
// End subscriptions if they weren't renewed for more than two months
$days = round((time() - strtotime($subscriber['renewed'])) / (60 * 60 * 24));
if ($days > 60) {
dba::update('push_subscriber', ['push' => -1, 'next_try' => NULL_DATE], ['id' => $id]);
logger('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.', LOGGER_DEBUG);
} else {
dba::update('push_subscriber', ['push' => 0, 'next_try' => NULL_DATE], ['id' => $id]);
logger('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.', LOGGER_DEBUG);
}
} else {
// Calculate the delay until the next trial
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
$retrial = $retrial + 1;
dba::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
logger('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next, LOGGER_DEBUG);
}
}
/**
* @brief Reset the push subscriber
*
* @param integer $id Subscriber ID
* @param date $last_update Date of last transmitted item
*/
public static function reset($id, $last_update)
{
$subscriber = dba::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
if (!DBM::is_result($subscriber)) {
return;
}
// set last_update to the 'created' date of the last item, and reset push=0
$fields = ['push' => 0, 'next_try' => NULL_DATE, 'last_update' => $last_update];
dba::update('push_subscriber', $fields, ['id' => $id]);
logger('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital', LOGGER_DEBUG);
}
}

View file

@ -331,6 +331,7 @@ class User
$confirm = x($data, 'confirm') ? trim($data['confirm']) : '';
$blocked = x($data, 'blocked') ? intval($data['blocked']) : 0;
$verified = x($data, 'verified') ? intval($data['verified']) : 0;
$language = x($data, 'language') ? notags(trim($data['language'])) : 'en';
$publish = x($data, 'profile_publish_reg') && intval($data['profile_publish_reg']) ? 1 : 0;
$netpublish = strlen(Config::get('system', 'directory')) ? $publish : 0;
@ -359,7 +360,7 @@ class User
$_SESSION['register'] = 1;
$_SESSION['openid'] = $openid_url;
$openid = new LightOpenID;
$openid = new LightOpenID($a->get_hostname());
$openid->identity = $openid_url;
$openid->returnUrl = System::baseUrl() . '/openid';
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
@ -466,6 +467,7 @@ class User
'sprvkey' => $sprvkey,
'verified' => $verified,
'blocked' => $blocked,
'language' => $language,
'timezone' => 'UTC',
'register_date' => DateTimeFormat::utcNow(),
'default-location' => ''

View file

@ -90,7 +90,8 @@ class Login extends BaseModule
// Otherwise it's probably an openid.
try {
$openid = new LightOpenID;
$a = get_app();
$openid = new LightOpenID($a->get_hostname());
$openid->identity = $openid_url;
$_SESSION['openid'] = $openid_url;
$_SESSION['remember'] = $remember;

View file

@ -16,6 +16,29 @@ use Friendica\Content\Text\BBCode;
class Tos extends BaseModule
{
// Some text elements we need more than once to keep updating them easy.
public $privacy_operate;
public $privacy_distribute;
public $privacy_delete;
public $privacy_complete;
/**
* @brief constructor for the module, initializing the text variables
*
* To make the text variables available outside of the module, they need to
* be properties of the class, however cannot be set directly as the property
* cannot depend on a function result when declaring the variable.
**/
public function __construct()
{
$this->privacy_operate = L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
$this->privacy_distribute = L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
$this->privacy_delete = L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/uexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', System::baseurl());
// In some cases we don't need every single one of the above separate, but all in one block.
// So here is an array to look over
$this->privacy_complete = [L10n::t('Privacy Statement'), $this->privacy_operate, $this->privacy_distribute, $this->privacy_delete];
}
/**
* @brief initialize the TOS module.
*
@ -42,16 +65,15 @@ class Tos extends BaseModule
**/
public static function content() {
$tpl = get_markup_template('tos.tpl');
if (Config::get('system', 'tosdisplay'))
{
if (Config::get('system', 'tosdisplay')) {
return replace_macros($tpl, [
'$title' => L10n::t("Terms of Service"),
'$title' => L10n::t('Terms of Service'),
'$tostext' => BBCode::convert(Config::get('system', 'tostext')),
'$displayprivstatement' => Config::get('system', 'tosprivstatement'),
'$privstatementtitle' => L10n::t("Privacy Statement"),
'$privoperate' => L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
'$privdistribute' => L10n::t('This data is required for communication and is passed on to the nodes of the communication partners. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
'$privdelete' => L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/uexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent.', System::baseurl())
'$privstatementtitle' => L10n::t('Privacy Statement'),
'$privacy_operate' => L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
'$privacy_distribute' => L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
'$privacy_delete' => L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/uexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', System::baseurl())
]);
} else {
return;

View file

@ -20,7 +20,7 @@ use Friendica\Protocol\Feed;
use Friendica\Util\Crypto;
use Friendica\Util\Network;
use Friendica\Util\XML;
use Friendica\Util\DateTimeFormat;
use dba;
use DOMXPath;
use DOMDocument;
@ -357,11 +357,11 @@ class Probe
}
}
if (self::$baseurl != "") {
if (!empty(self::$baseurl)) {
$data["baseurl"] = self::$baseurl;
}
if (!isset($data["network"])) {
if (empty($data["network"])) {
$data["network"] = NETWORK_PHANTOM;
}
@ -395,6 +395,12 @@ class Probe
'network' => $data['network'],
'server_url' => $data['baseurl']];
// This doesn't cover the case when a community isn't a community anymore
if (!empty($data['community']) && $data['community']) {
$fields['community'] = $data['community'];
$fields['contact-type'] = ACCOUNT_TYPE_COMMUNITY;
}
$fieldnames = [];
foreach ($fields as $key => $val) {
@ -411,6 +417,17 @@ class Probe
$old_fields = dba::selectFirst('gcontact', $fieldnames, $condition);
// When the gcontact doesn't exist, the value "true" will trigger an insert.
// In difference to the public contacts we want to have every contact
// in the world in our global contacts.
if (!$old_fields) {
$old_fields = true;
// These values have to be set only on insert
$fields['photo'] = $data['photo'];
$fields['created'] = DateTimeFormat::utcNow();
}
dba::update('gcontact', $fields, $condition, $old_fields);
$fields = ['name' => $data['name'],
@ -428,7 +445,10 @@ class Probe
'confirm' => $data['confirm'],
'poco' => $data['poco'],
'network' => $data['network'],
'success_update' => DBM::date()];
'pubkey' => $data['pubkey'],
'priority' => $data['priority'],
'writable' => true,
'rel' => CONTACT_IS_SHARING];
$fieldnames = [];
@ -442,14 +462,15 @@ class Probe
$condition = ['nurl' => normalise_link($data["url"]), 'self' => false, 'uid' => 0];
// "$old_fields" will return a "false" when the contact doesn't exist.
// This won't trigger an insert. This is intended, since we only need
// public contacts for everyone we store items from.
// We don't need to store every contact on the planet.
$old_fields = dba::selectFirst('contact', $fieldnames, $condition);
// When the contact doesn't exist, the value "true" will trigger an insert
if (!$old_fields) {
$old_fields = true;
$fields['blocked'] = false;
$fields['pending'] = false;
}
$fields['name-date'] = DateTimeFormat::utcNow();
$fields['uri-date'] = DateTimeFormat::utcNow();
$fields['success_update'] = DateTimeFormat::utcNow();
dba::update('contact', $fields, $condition, $old_fields);
}

View file

@ -172,13 +172,31 @@ class Post extends BaseObject
$dropping = true;
}
$origin = $item['origin'];
if (!$origin) {
/// @todo This shouldn't be done as query here, but better during the data creation.
// it is now done here, since during the RC phase we shouldn't make to intense changes.
$parent = dba::selectFirst('item', ['origin'], ['id' => $item['parent']]);
if (DBM::is_result($parent)) {
$origin = $parent['origin'];
}
}
// Showing the one or the other text, depending upon if we can only hide it or really delete it.
$delete = $origin ? L10n::t('Delete') : L10n::t('Remove from your stream');
$drop = [
'dropping' => $dropping,
'pagedrop' => ((Feature::isEnabled($conv->getProfileOwner(), 'multi_delete')) ? $item['pagedrop'] : ''),
'select' => L10n::t('Select'),
'delete' => L10n::t('Delete'),
'delete' => $delete,
];
if (!local_user()) {
$drop = false;
}
$filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? L10n::t("save to folder") : false);
$diff_author = !link_compare($item['url'], $item['author-link']);
@ -199,23 +217,13 @@ class Post extends BaseObject
$profile_link = Profile::zrl($profile_link);
}
if (!isset($item['author-thumb']) || ($item['author-thumb'] == "")) {
$author_contact = Contact::getDetailsByURL($item['author-link'], $conv->getProfileOwner());
if ($author_contact["thumb"]) {
$item['author-thumb'] = $author_contact["thumb"];
} else {
if (($item['network'] == NETWORK_FEED) || empty($item['author-thumb'])) {
$item['author-thumb'] = $item['author-avatar'];
}
}
if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) {
$owner_contact = Contact::getDetailsByURL($item['owner-link'], $conv->getProfileOwner());
if ($owner_contact["thumb"]) {
$item['owner-thumb'] = $owner_contact["thumb"];
} else {
if (($item['network'] == NETWORK_FEED) || empty($item['owner-thumb'])) {
$item['owner-thumb'] = $item['owner-avatar'];
}
}
$locate = ['location' => $item['location'], 'coord' => $item['coord'], 'html' => ''];
Addon::callHooks('render_location', $locate);

View file

@ -50,9 +50,9 @@ require_once "include/text.php";
class DFRN
{
const DFRN_TOP_LEVEL = 0; // Top level posting
const DFRN_REPLY = 1; // Regular reply that is stored locally
const DFRN_REPLY_RC = 2; // Reply that will be relayed
const TOP_LEVEL = 0; // Top level posting
const REPLY = 1; // Regular reply that is stored locally
const REPLY_RC = 2; // Reply that will be relayed
/**
* @brief Generates the atom entries for delivery.php
@ -2146,10 +2146,6 @@ class DFRN
Item::update($fields, $condition);
$changed = true;
if ($entrytype == DFRN_REPLY_RC) {
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $current["id"]);
}
}
return $changed;
}
@ -2217,12 +2213,12 @@ class DFRN
}
if ($is_a_remote_action) {
return DFRN_REPLY_RC;
return DFRN::REPLY_RC;
} else {
return DFRN_REPLY;
return DFRN::REPLY;
}
} else {
return DFRN_TOP_LEVEL;
return DFRN::TOP_LEVEL;
}
}
@ -2296,7 +2292,7 @@ class DFRN
{
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
if (($entrytype == DFRN_TOP_LEVEL)) {
if (($entrytype == DFRN::TOP_LEVEL)) {
// The filling of the the "contact" variable is done for legcy reasons
// The functions below are partly used by ostatus.php as well - where we have this variable
$r = q("SELECT * FROM `contact` WHERE `id` = %d", intval($importer["id"]));
@ -2640,7 +2636,7 @@ class DFRN
$entrytype = self::getEntryType($importer, $item);
// Now assign the rest of the values that depend on the type of the message
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
if (!isset($item["object-type"])) {
$item["object-type"] = ACTIVITY_OBJ_COMMENT;
}
@ -2662,10 +2658,10 @@ class DFRN
}
}
if ($entrytype == DFRN_REPLY_RC) {
if ($entrytype == DFRN::REPLY_RC) {
$item["type"] = "remote-comment";
$item["wall"] = 1;
} elseif ($entrytype == DFRN_TOP_LEVEL) {
} elseif ($entrytype == DFRN::TOP_LEVEL) {
if (!isset($item["object-type"])) {
$item["object-type"] = ACTIVITY_OBJ_NOTE;
}
@ -2714,7 +2710,7 @@ class DFRN
return;
}
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
$posted_id = Item::insert($item);
$parent = 0;
@ -2725,26 +2721,9 @@ class DFRN
Item::distribute($posted_id);
}
$item["id"] = $posted_id;
$r = q(
"SELECT `parent`, `parent-uri` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($posted_id),
intval($importer["importer_uid"])
);
if (DBM::is_result($r)) {
$parent = $r[0]["parent"];
$parent_uri = $r[0]["parent-uri"];
}
if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $posted_id);
}
return true;
}
} else { // $entrytype == DFRN_TOP_LEVEL
} else { // $entrytype == DFRN::TOP_LEVEL
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
return;
@ -2835,23 +2814,13 @@ class DFRN
}
}
$entrytype = self::getEntryType($importer, $item);
if (!$item["deleted"]) {
logger('deleting item '.$item["id"].' uri='.$uri, LOGGER_DEBUG);
} else {
if ($item["deleted"]) {
return;
}
Item::deleteById($item["id"]);
logger('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG);
if ($entrytype != DFRN_TOP_LEVEL) {
// if this is a relayed delete, propagate it to other recipients
if ($entrytype == DFRN_REPLY_RC) {
logger("Notifying followers about deletion of post " . $item["id"], LOGGER_DEBUG);
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $item["id"]);
}
}
Item::delete(['id' => $item['id']]);
}
/**

View file

@ -920,7 +920,7 @@ class Diaspora
// Note that Friendica contacts will return a "Diaspora person"
// if Diaspora connectivity is enabled on their server
if ($r && ($r["network"] === NETWORK_DIASPORA)) {
self::addFContact($r, $update);
self::updateFContact($r);
// Fetch the updated or added contact
$person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
@ -937,69 +937,20 @@ class Diaspora
* @brief Updates the fcontact table
*
* @param array $arr The fcontact data
* @param bool $update Update or insert?
*
* @return string The id of the fcontact entry
*/
private static function addFContact($arr, $update = false)
private static function updateFContact($arr)
{
if ($update) {
$r = q(
"UPDATE `fcontact` SET
`name` = '%s',
`photo` = '%s',
`request` = '%s',
`nick` = '%s',
`addr` = '%s',
`guid` = '%s',
`batch` = '%s',
`notify` = '%s',
`poll` = '%s',
`confirm` = '%s',
`alias` = '%s',
`pubkey` = '%s',
`updated` = '%s'
WHERE `url` = '%s' AND `network` = '%s'",
dbesc($arr["name"]),
dbesc($arr["photo"]),
dbesc($arr["request"]),
dbesc($arr["nick"]),
dbesc(strtolower($arr["addr"])),
dbesc($arr["guid"]),
dbesc($arr["batch"]),
dbesc($arr["notify"]),
dbesc($arr["poll"]),
dbesc($arr["confirm"]),
dbesc($arr["alias"]),
dbesc($arr["pubkey"]),
dbesc(DateTimeFormat::utcNow()),
dbesc($arr["url"]),
dbesc($arr["network"])
);
} else {
$r = q(
"INSERT INTO `fcontact` (`url`,`name`,`photo`,`request`,`nick`,`addr`, `guid`,
`batch`, `notify`,`poll`,`confirm`,`network`,`alias`,`pubkey`,`updated`)
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
dbesc($arr["url"]),
dbesc($arr["name"]),
dbesc($arr["photo"]),
dbesc($arr["request"]),
dbesc($arr["nick"]),
dbesc($arr["addr"]),
dbesc($arr["guid"]),
dbesc($arr["batch"]),
dbesc($arr["notify"]),
dbesc($arr["poll"]),
dbesc($arr["confirm"]),
dbesc($arr["network"]),
dbesc($arr["alias"]),
dbesc($arr["pubkey"]),
dbesc(DateTimeFormat::utcNow())
);
}
$fields = ['name' => $arr["name"], 'photo' => $arr["photo"],
'request' => $arr["request"], 'nick' => $arr["nick"],
'addr' => strtolower($arr["addr"]), 'guid' => $arr["guid"],
'batch' => $arr["batch"], 'notify' => $arr["notify"],
'poll' => $arr["poll"], 'confirm' => $arr["confirm"],
'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"],
'updated' => DateTimeFormat::utcNow()];
return $r;
$condition = ['url' => $arr["url"], 'network' => $arr["network"]];
dba::update('fcontact', $fields, $condition, true);
}
/**
@ -1796,6 +1747,12 @@ class Diaspora
self::fetchGuid($datarray);
// If we are the origin of the parent we store the original data.
// We notify our followers during the item storage.
if ($parent_item["origin"]) {
$datarray['diaspora_signed_text'] = json_encode($data);
}
$message_id = Item::insert($datarray);
if ($message_id <= 0) {
@ -1805,20 +1762,10 @@ class Diaspora
if ($message_id) {
logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
Item::distribute($message_id, json_encode($data));
}
}
// If we are the origin of the parent we store the original data and notify our followers
if ($message_id && $parent_item["origin"]) {
// Formerly we stored the signed text, the signature and the author in different fields.
// We now store the raw data so that we are more flexible.
dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($data)]);
// notify others
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $message_id);
}
return true;
}
@ -2120,6 +2067,20 @@ class Diaspora
$datarray["body"] = self::constructLikeBody($contact, $parent_item, $guid);
// like on comments have the comment as parent. So we need to fetch the toplevel parent
if ($parent_item["id"] != $parent_item["parent"]) {
$toplevel = dba::selectFirst('item', ['origin'], ['id' => $parent_item["parent"]]);
$origin = $toplevel["origin"];
} else {
$origin = $parent_item["origin"];
}
// If we are the origin of the parent we store the original data.
// We notify our followers during the item storage.
if ($origin) {
$datarray['diaspora_signed_text'] = json_encode($data);
}
$message_id = Item::insert($datarray);
if ($message_id <= 0) {
@ -2129,28 +2090,10 @@ class Diaspora
if ($message_id) {
logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
if ($datarray['uid'] == 0) {
Item::distribute($message_id);
Item::distribute($message_id, json_encode($data));
}
}
// like on comments have the comment as parent. So we need to fetch the toplevel parent
if ($parent_item["id"] != $parent_item["parent"]) {
$toplevel = dba::selectFirst('item', ['origin'], ['id' => $parent_item["parent"]]);
$origin = $toplevel["origin"];
} else {
$origin = $parent_item["origin"];
}
// If we are the origin of the parent we store the original data and notify our followers
if ($message_id && $origin) {
// Formerly we stored the signed text, the signature and the author in different fields.
// We now store the raw data so that we are more flexible.
dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($data)]);
// notify others
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $message_id);
}
return true;
}
@ -2398,21 +2341,17 @@ class Diaspora
$birthday = $contact["bd"];
}
$r = q(
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `bd` = '%s',
`location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($name),
dbesc($nick),
dbesc($author),
dbesc(DateTimeFormat::utcNow()),
dbesc($birthday),
dbesc($location),
dbesc($about),
dbesc($keywords),
dbesc($gender),
intval($contact["id"]),
intval($importer["uid"])
);
$fields = ['name' => $name, 'location' => $location,
'name-date' => DateTimeFormat::utcNow(),
'about' => $about, 'gender' => $gender,
'addr' => $author, 'nick' => $nick,
'keywords' => $keywords];
if (!empty($birthday)) {
$fields['bd'] = $birthday;
}
dba::update('contact', $fields, ['id' => $contact['id']]);
$gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
"photo" => $image_url, "name" => $name, "location" => $location,
@ -2447,78 +2386,6 @@ class Diaspora
['id' => $contact["id"], 'uid' => $importer["uid"]]
);
}
// send notification
$r = q(
"SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
intval($importer["uid"])
);
if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(PConfig::get($importer["uid"], "system", "post_newfriend"))) {
$self = q(
"SELECT * FROM `contact` WHERE `self` AND `uid` = %d LIMIT 1",
intval($importer["uid"])
);
// they are not CONTACT_IS_FOLLOWER anymore but that's what we have in the array
if ($self && $contact["rel"] == CONTACT_IS_FOLLOWER) {
$arr = [];
$arr["protocol"] = PROTOCOL_DIASPORA;
$arr["uri"] = $arr["parent-uri"] = item_new_uri($a->get_hostname(), $importer["uid"]);
$arr["uid"] = $importer["uid"];
$arr["contact-id"] = $self[0]["id"];
$arr["wall"] = 1;
$arr["type"] = 'wall';
$arr["gravity"] = 0;
$arr["origin"] = 1;
$arr["author-name"] = $arr["owner-name"] = $self[0]["name"];
$arr["author-link"] = $arr["owner-link"] = $self[0]["url"];
$arr["author-avatar"] = $arr["owner-avatar"] = $self[0]["thumb"];
$arr["verb"] = ACTIVITY_FRIEND;
$arr["object-type"] = ACTIVITY_OBJ_PERSON;
$A = "[url=".$self[0]["url"]."]".$self[0]["name"]."[/url]";
$B = "[url=".$contact["url"]."]".$contact["name"]."[/url]";
$BPhoto = "[url=".$contact["url"]."][img]".$contact["thumb"]."[/img][/url]";
$arr["body"] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$BPhoto;
$arr["object"] = self::constructNewFriendObject($contact);
$user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
$arr["allow_cid"] = $user["allow_cid"];
$arr["allow_gid"] = $user["allow_gid"];
$arr["deny_cid"] = $user["deny_cid"];
$arr["deny_gid"] = $user["deny_gid"];
$i = Item::insert($arr);
if ($i) {
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
}
}
}
}
/**
* @brief Creates a XML object for a "new friend" message
*
* @param array $contact Array of the contact
*
* @return string The XML
*/
private static function constructNewFriendObject($contact)
{
$objtype = ACTIVITY_OBJ_PERSON;
$link = '<link rel="alternate" type="text/html" href="'.$contact["url"].'" />'."\n".
'<link rel="photo" type="image/jpeg" href="'.$contact["thumb"].'" />'."\n";
$xmldata = ["object" => ["type" => $objtype,
"title" => $contact["name"],
"id" => $contact["url"]."/".$contact["name"],
"link" => $link]];
return XML::fromArray($xmldata, $xml, true);
}
/**
@ -2918,7 +2785,7 @@ class Diaspora
while ($item = dba::fetch($r)) {
// Fetch the parent item
$parent = dba::selectFirst('item', ['author-link', 'origin'], ['id' => $item["parent"]]);
$parent = dba::selectFirst('item', ['author-link'], ['id' => $item["parent"]]);
// Only delete it if the parent author really fits
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
@ -2926,15 +2793,9 @@ class Diaspora
continue;
}
Item::deleteById($item["id"]);
Item::delete(['id' => $item['id']]);
logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
// Now check if the retraction needs to be relayed by us
if ($parent["origin"]) {
// notify others
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $item["id"]);
}
}
return true;
@ -3568,6 +3429,10 @@ class Diaspora
$ret["root_handle"] = self::handleFromContact($item["contact-id"]);
$ret["root_guid"] = $guid;
return $ret;
} elseif ($complete) {
// We are resharing something that isn't a DFRN or Diaspora post.
// So we have to return "false" on "$complete" to not trigger a reshare.
return false;
}
} elseif (($guid == "") && $complete) {
return false;

View file

@ -430,6 +430,9 @@ class Feed {
$item['guid'] = Item::guidFromUri($orig_plink, $a->get_hostname());
unset($item['uri']);
unset($item['parent-uri']);
// Set the delivery priority for "remote self" to "medium"
$notify = PRIORITY_MEDIUM;
}
$id = Item::insert($item, false, $notify);

View file

@ -537,13 +537,12 @@ class OStatus
private static function deleteNotice($item)
{
$condition = ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']];
$deleted = dba::selectFirst('item', ['id', 'parent-uri'], $condition);
if (!DBM::is_result($deleted)) {
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it. ");
if (!dba::exists('item', $condition)) {
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
return;
}
Item::deleteById($deleted["id"]);
Item::delete($condition);
logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
}

View file

@ -522,7 +522,12 @@ class PortableContact
}
}
$fields = ['updated' => $last_updated, 'last_contact' => DateTimeFormat::utcNow()];
$fields = ['last_contact' => DateTimeFormat::utcNow()];
if (!empty($last_updated)) {
$fields['updated'] = $last_updated;
}
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
if (($gcontacts[0]["generation"] == 0)) {
@ -1415,7 +1420,7 @@ class PortableContact
}
foreach ($tags as $tag) {
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag]);
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
}
}
@ -1424,13 +1429,21 @@ class PortableContact
if (isset($data->protocols)) {
if (isset($data->protocols->diaspora)) {
$fields['network'] = NETWORK_DIASPORA;
if (isset($data->protocols->diaspora->receive)) {
$fields['batch'] = $data->protocols->diaspora->receive;
} elseif (is_string($data->protocols->diaspora)) {
$fields['batch'] = $data->protocols->diaspora;
}
}
if (isset($data->protocols->dfrn)) {
$fields['network'] = NETWORK_DFRN;
if (isset($data->protocols->dfrn->receive)) {
$fields['batch'] = $data->protocols->dfrn->receive;
} elseif (is_string($data->protocols->dfrn)) {
$fields['batch'] = $data->protocols->dfrn;
}
}
}
Diaspora::setRelayContact($server_url, $fields);
}
@ -1502,10 +1515,12 @@ class PortableContact
if ($serverdata) {
$servers = json_decode($serverdata);
if (is_array($servers->pods)) {
foreach ($servers->pods as $server) {
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", "https://".$server->host);
}
}
}
// Disvover Mastodon servers
if (!Config::get('system', 'ostatus_disabled')) {

View file

@ -58,9 +58,6 @@ Class Cron {
// Call possible post update functions
Worker::add(PRIORITY_LOW, "CronJobs", "post_update");
// update nodeinfo data
Worker::add(PRIORITY_LOW, "CronJobs", "nodeinfo");
// Clear cache entries
Worker::add(PRIORITY_LOW, "CronJobs", "clear_cache");
@ -74,27 +71,42 @@ Class Cron {
$d1 = Config::get('system', 'last_expire_day');
$d2 = intval(DateTimeFormat::utcNow('d'));
// Daily cron calls
if ($d2 != intval($d1)) {
Worker::add(PRIORITY_LOW, "CronJobs", "update_contact_birthdays");
Worker::add(PRIORITY_LOW, "CronJobs", "update_photo_albums");
// update nodeinfo data
Worker::add(PRIORITY_LOW, "CronJobs", "nodeinfo");
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "update_server");
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "suggestions");
Config::set('system', 'last_expire_day', $d2);
Worker::add(PRIORITY_LOW, 'Expire');
Worker::add(PRIORITY_MEDIUM, 'DBClean');
Worker::add(PRIORITY_LOW, "CronJobs", "update_photo_albums");
// Delete all done workerqueue entries
dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 12 HOUR']);
// check upstream version?
Worker::add(PRIORITY_LOW, 'CheckVersion');
Config::set('system', 'last_expire_day', $d2);
}
// Hourly cron calls
if (Config::get('system', 'last_cron_hourly', 0) + 3600 < time()) {
// Delete all done workerqueue entries
dba::delete('workerqueue', ['`done` AND `executed` < UTC_TIMESTAMP() - INTERVAL 1 HOUR']);
// Optimizing this table only last seconds
if (Config::get('system', 'optimize_workerqueue', false)) {
dba::e("OPTIMIZE TABLE `workerqueue`");
}
Config::set('system', 'last_cron_hourly', time());
}
// Poll contacts

View file

@ -26,8 +26,6 @@ class CronJobs
{
global $a;
require_once 'mod/nodeinfo.php';
// No parameter set? So return
if ($command == '') {
return;

View file

@ -11,6 +11,7 @@ use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\User;
use Friendica\Model\PushSubscriber;
use Friendica\Network\Probe;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
@ -498,19 +499,13 @@ class Notifier {
// Notify PuSH subscribers (Used for OStatus distribution of regular posts)
if ($push_notify) {
// Set push flag for PuSH subscribers to this topic,
// they will be notified in queue.php
$condition = ['push' => false, 'nickname' => $owner['nickname']];
dba::update('push_subscriber', ['push' => true], $condition);
logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
// Handling the pubsubhubbub requests
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true],
'PubSubPublish');
PushSubscriber::publishFeed($owner['uid'], $a->queue['priority']);
}
logger('notifier: calling hooks', LOGGER_DEBUG);
logger('notifier: calling hooks for ' . $cmd . ' ' . $item_id, LOGGER_DEBUG);
if ($normal_mode) {
Addon::forkHooks($a->queue['priority'], 'notifier_normal', $target_item);

View file

@ -7,11 +7,10 @@ namespace Friendica\Worker;
use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Protocol\OStatus;
use Friendica\Util\Network;
use Friendica\Model\PushSubscriber;
use dba;
require_once 'include/items.php';
@ -19,78 +18,56 @@ require_once 'include/items.php';
class PubSubPublish {
public static function execute($pubsubpublish_id = 0)
{
global $a;
if ($pubsubpublish_id == 0) {
// We'll push to each subscriber that has push > 0,
// i.e. there has been an update (set in notifier.php).
$r = q("SELECT `id`, `callback_url` FROM `push_subscriber` WHERE `push` > 0 ORDER BY `last_update` DESC");
foreach ($r as $rr) {
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
Worker::add(['priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true],
'PubSubPublish', (int)$rr["id"]);
}
return;
}
self::publish($pubsubpublish_id);
return;
}
private static function publish($id) {
global $a;
$r = q("SELECT * FROM `push_subscriber` WHERE `id` = %d", intval($id));
if (!DBM::is_result($r)) {
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
if (!DBM::is_result($subscriber)) {
return;
}
$rr = $r[0];
/// @todo Check server status with PortableContact::checkServer()
// Before this can be done we need a way to safely detect the server url.
logger("Generate feed of user ".$rr['nickname']." to ".$rr['callback_url']." - last updated ".$rr['last_update'], LOGGER_DEBUG);
logger("Generate feed of user " . $subscriber['nickname']. " to " . $subscriber['callback_url']. " - last updated " . $subscriber['last_update'], LOGGER_DEBUG);
$last_update = $rr['last_update'];
$params = OStatus::feed($rr['nickname'], $last_update);
$last_update = $subscriber['last_update'];
$params = OStatus::feed($subscriber['nickname'], $last_update);
if (!$params) {
return;
}
$hmac_sig = hash_hmac("sha1", $params, $rr['secret']);
$hmac_sig = hash_hmac("sha1", $params, $subscriber['secret']);
$headers = ["Content-type: application/atom+xml",
sprintf("Link: <%s>;rel=hub,<%s>;rel=self",
System::baseUrl().'/pubsubhubbub/'.$rr['nickname'],
$rr['topic']),
"X-Hub-Signature: sha1=".$hmac_sig];
System::baseUrl() . '/pubsubhubbub/' . $subscriber['nickname'],
$subscriber['topic']),
"X-Hub-Signature: sha1=" . $hmac_sig];
logger('POST '.print_r($headers, true)."\n".$params, LOGGER_DATA);
logger('POST ' . print_r($headers, true) . "\n" . $params, LOGGER_DATA);
Network::post($rr['callback_url'], $params, $headers);
Network::post($subscriber['callback_url'], $params, $headers);
$ret = $a->get_curl_code();
$condition = ['id' => $subscriber['id']];
if ($ret >= 200 && $ret <= 299) {
logger('successfully pushed to '.$rr['callback_url']);
// set last_update to the "created" date of the last item, and reset push=0
$fields = ['push' => 0, 'last_update' => $last_update];
dba::update('push_subscriber', $fields, ['id' => $rr['id']]);
logger('Successfully pushed to ' . $subscriber['callback_url']);
PushSubscriber::reset($subscriber['id'], $last_update);
} else {
logger('error when pushing to '.$rr['callback_url'].' HTTP: '.$ret);
logger('Delivery error when pushing to ' . $subscriber['callback_url'] . ' HTTP: ' . $ret);
// we use the push variable also as a counter, if we failed we
// increment this until some upper limit where we give up
$new_push = intval($rr['push']) + 1;
if ($new_push > 30) // OK, let's give up
$new_push = 0;
dba::update('push_subscriber', ['push' => $new_push], ['id' => $rr['id']]);
PushSubscriber::delay($subscriber['id']);
}
}
}

View file

@ -10,6 +10,7 @@ use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Queue as QueueModel;
use Friendica\Model\PushSubscriber;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\PortableContact;
@ -34,7 +35,7 @@ class Queue
logger('filling queue jobs - start');
// Handling the pubsubhubbub requests
Worker::add(['priority' => PRIORITY_HIGH, 'dont_fork' => true], 'PubSubPublish');
PushSubscriber::requeue();
$r = dba::inArray(dba::p("SELECT `id` FROM `queue` WHERE `next` < UTC_TIMESTAMP() ORDER BY `batch`, `cid`"));

View file

@ -5,7 +5,10 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Core\L10n;
require_once 'include/dba.php';
@ -184,3 +187,49 @@ WHERE `hook` LIKE 'plugin_%'");
// Make sure we install the new renamed ones
Addon::reload();
}
function update_1260() {
Config::set('system', 'maintenance', 1);
Config::set('system', 'maintenance_reason', L10n::t('%s: Updating author-id and owner-id in item and thread table. ', DBM::date().' '.date('e')));
$items = dba::p("SELECT `id`, `owner-link`, `owner-name`, `owner-avatar`, `network` FROM `item`
WHERE `owner-id` = 0 AND `owner-link` != ''");
while ($item = dba::fetch($items)) {
$contact = ['url' => $item['owner-link'], 'name' => $item['owner-name'],
'photo' => $item['owner-avatar'], 'network' => $item['network']];
$cid = Contact::getIdForURL($item['owner-link'], 0, false, $contact);
if (empty($cid)) {
continue;
}
Item::update(['owner-id' => $cid], ['id' => $item['id']]);
}
dba::close($items);
dba::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
SET `thread`.`owner-id` = `item`.`owner-id` WHERE `thread`.`owner-id` = 0");
$items = dba::p("SELECT `id`, `author-link`, `author-name`, `author-avatar`, `network` FROM `item`
WHERE `author-id` = 0 AND `author-link` != ''");
while ($item = dba::fetch($items)) {
$contact = ['url' => $item['author-link'], 'name' => $item['author-name'],
'photo' => $item['author-avatar'], 'network' => $item['network']];
$cid = Contact::getIdForURL($item['author-link'], 0, false, $contact);
if (empty($cid)) {
continue;
}
Item::update(['author-id' => $cid], ['id' => $item['id']]);
}
dba::close($items);
dba::e("UPDATE `thread` INNER JOIN `item` ON `thread`.`iid` = `item`.`id`
SET `thread`.`author-id` = `item`.`author-id` WHERE `thread`.`author-id` = 0");
Config::set('system', 'maintenance', 0);
return UPDATE_SUCCESS;
}
function update_1261() {
// This fixes the results of an issue in the develop branch of 2018-05.
dba::update('contact', ['blocked' => false, 'pending' => false], ['uid' => 0, 'blocked' => true, 'pending' => true]);
return UPDATE_SUCCESS;
}

View file

@ -1,8 +1,10 @@
23n
Abinoam P. Marques Jr.
Abrax
Adam Clark
Adam Jurkiewicz
Adam Magness
AgnesElisa
Albert
Alberto Díaz Tormo
Alex
@ -10,6 +12,7 @@ Alexander Fortin
Alexander Kampmann
Alexandre Alapetite
AlfredSK
Andi
Andi Stadler
Andreas H.
Andreas Neustifter
@ -28,6 +31,8 @@ balderino
Beanow
beardyunixer
Beatriz Vital
Beluga
Ben
Ben Roberts
ben-utzer
bufalo1973
@ -40,6 +45,7 @@ Christian González
Christian M. Grube
Christian Vogeley
Cohan Robinson
Copiis Praeesse
Cyboulette
Cyryl Sochacki
czarnystokrotek
@ -89,11 +95,13 @@ Herbert Thielen
hoergen
Hubert Kościański
Hypolite Petovan
Ilmari
irhen
Jak
Jakob
Jens Tautenhahn
jensp
Jeroen De Meerleer
jeroenpraat
Johannes Schwab
John Brazil
@ -101,10 +109,13 @@ Jonatan Nyberg
Josef Moravek
juanman
julia.domagalska
Karel
Karel Vandecandelaere
Karolina
Keith Fernie
Klaus Weidenbach
Koyu Berteon
Kris
Lea1995polish
Leberwurscht
Leonard Lausen
@ -115,6 +126,7 @@ Magdalena Gazda
Mai Anh Nguyen
Manuel Pérez Monís
Marcin Klessa
Marcus Müller
Mariusz Pisz
marmor
Marquis_de_Carabas
@ -143,6 +155,7 @@ Paolo Wave
Pavel Morozov
Perig Gouanvic
peturisfeld
Philipp Holzer
Pierre Rudloff
Piotr Blonkowski
pokerazor
@ -162,6 +175,7 @@ Rui Andrada
S.Krumbholz
Sakałoŭ Alaksiej
Sam
Samuli Valavuo
Sandro Santilli
Sebastian Egbers
sella
@ -181,6 +195,7 @@ szymon.filip
Sérgio Lima
Taekus
Tazman DeVille
teho
Thecross
Thomas
Thomas Willingham
@ -202,6 +217,7 @@ Vasudev Kamath
Vasya Novikov
vislav
Vít Šesták 'v6ak'
Waldemar Stoczkowski
Yasen Pramatarov
ylms
Zach Prezkuta
@ -210,4 +226,5 @@ zotlabs
zottel
Zvi ben Yaakov (a.k.a rdc)
Михаил
Олексій Замковий
朱陈锬

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_bg")) {
function string_plural_select_bg($n){
$n = intval($n);
return ($n != 1);;
}}
;

View file

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_ca")) {
function string_plural_select_ca($n){
$n = intval($n);
return ($n != 1);;
}}
;

View file

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_cs")) {
function string_plural_select_cs($n){
$n = intval($n);
return ($n==1) ? 0 : ($n>=2 && $n<=4) ? 1 : 2;;
}}
;

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

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

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_eo")) {
function string_plural_select_eo($n){
$n = intval($n);
return ($n != 1);;
}}
;

View file

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_es")) {
function string_plural_select_es($n){
$n = intval($n);
return ($n != 1);;
}}
;

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

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

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
if(! function_exists("string_plural_select_nb_no")) {
function string_plural_select_nb_no($n){
$n = intval($n);
return ($n != 1);;
}}
;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

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