Merge remote-tracking branch 'upstream/develop' into rewrites/coding-convention-split2-6-2
Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
commit
4e49939421
148
CHANGELOG
148
CHANGELOG
|
@ -1,10 +1,64 @@
|
||||||
|
Version 3.5.2 (2017-06-06)
|
||||||
|
Friendica Core:
|
||||||
|
Updates to the translations (DE, EN-GB, EN-US, ES, IT, PT-BR, RU) [translation teams]
|
||||||
|
Updates to the documentation [annando, beardyunixer, rabuzarus, tobiasd]
|
||||||
|
Updated the nginx example configuration [beardyunixer]
|
||||||
|
Code revision and refactoring [annando, hypolite, Quix0r, rebeka-catalina]
|
||||||
|
Background process is now done by the new worker process [annando]
|
||||||
|
Added support of Composer for dependencies [Hypolite]
|
||||||
|
Added support of Web app manifests [Rudloff]
|
||||||
|
Added basic robot.txt functionality if none exists [Shnoulle]
|
||||||
|
Added server blocklist [Hypolite, tobiasd]
|
||||||
|
Removed mcrypt dependency [annando]
|
||||||
|
Removed unused libraries [annando]
|
||||||
|
Removed Embedly integration [Hypolite]
|
||||||
|
Fixed a bug in the language detection for EN [Hypolite]
|
||||||
|
Fixed a bug in the probing mechanism on old PHP version [annando]
|
||||||
|
Improved API [annando, gerhard6380]
|
||||||
|
Improved Diaspora federation [annando]
|
||||||
|
Improved Mastodon federation [annando, Hypolite]
|
||||||
|
Improved import from OStatus threads [annando]
|
||||||
|
Improved the themes (frio, quattro) [fabrixxm, Hypolite, rabuzarus, Rudloff, strk, tobiasd]
|
||||||
|
Improved maintenance mode [annando]
|
||||||
|
Improved gcontact handling [annando]
|
||||||
|
Improved desktop notifications [rabuzarus]
|
||||||
|
Improved keyboard shortcuts for navigation [Rudloff]
|
||||||
|
Improved the installer [annando]
|
||||||
|
Improved openid handling [strk]
|
||||||
|
Improved php7 support [annando]
|
||||||
|
Improved display of notifications [annando]
|
||||||
|
Improved logging mechanism [beardyunixer]
|
||||||
|
Improved the worker [annando]
|
||||||
|
Behaviour clarification of the group filter / new tab [annando]
|
||||||
|
Old options for the pager and share element were removed [annando]
|
||||||
|
Support of PDO was added [annando]
|
||||||
|
Improved error logging for issues with the database [annando]
|
||||||
|
Improved compatibility to MySQL version 5.7+ [annando]
|
||||||
|
|
||||||
|
Friendica Addons:
|
||||||
|
Updates to the translation (RU) [pztrm]
|
||||||
|
(core) Fix blocking issue for Communityhome [annando]
|
||||||
|
Pledgie addon was updated to remove cert problems [tobiasd]
|
||||||
|
Securemail now uses openpgp-php and phpseclib [fabrixxm]
|
||||||
|
Superblock Configuration [tobiasd]
|
||||||
|
Twitter Connector updated to use with new deletion method [annando]
|
||||||
|
|
||||||
|
Closed Issues:
|
||||||
|
1626, 1720, 2432, 2792, 2833, 2364, 2448, 2496, 2690, 2752, 2775,
|
||||||
|
2803, 2956, 2957, 2961, 2971, 2995, 2999, 3011, 3053, 3107, 3114,
|
||||||
|
3134, 3138, 3142, 3157, 3172, 3189, 3194, 3195, 3198, 3206, 3215,
|
||||||
|
3217, 3220, 3237, 3242, 3255, 3256, 3260, 3268, 3273, 3274, 3285,
|
||||||
|
3288, 3292, 3293, 3300, 3314, 3316, 3317, 3322, 3325, 3327, 3328,
|
||||||
|
3331, 3334, 3336, 3346, 3347, 3358, 3359, 3383, 3387, 3401, 3406,
|
||||||
|
3428, 3440, 3435, 3436, 3452
|
||||||
|
|
||||||
Version 3.5.1 (2017-03-12)
|
Version 3.5.1 (2017-03-12)
|
||||||
Friendica Core:
|
Friendica Core:
|
||||||
Updates to the translations (BG, CA, CS, DE, EO, ES, FR, IS, IT, NL, PL, PT-BR, RU, SV) [translation teams]
|
Updates to the translations (BG, CA, CS, DE, EO, ES, FR, IS, IT, NL, PL, PT-BR, RU, SV) [translation teams]
|
||||||
Fix for a potential XSS vector [heluecht, thanks to Vít Šesták 'v6ak' for reporting the problem]
|
Fix for a potential XSS vector [annando, thanks to Vít Šesták 'v6ak' for reporting the problem]
|
||||||
Fix for ghost request notifications on single user instances [Hypolite]
|
Fix for ghost request notifications on single user instances [Hypolite]
|
||||||
Fix user language selection [tobiasd]
|
Fix user language selection [tobiasd]
|
||||||
Fix a problem with communication to Diaspora with set posting locations [heluecht]
|
Fix a problem with communication to Diaspora with set posting locations [annando]
|
||||||
Fix schema handling of direct links to a original posting [Rabuzarus]
|
Fix schema handling of direct links to a original posting [Rabuzarus]
|
||||||
Fix a bug in notification handling [Rabuzarus]
|
Fix a bug in notification handling [Rabuzarus]
|
||||||
Adjustments for the Vagrant VM settings [silke, eelcomaljaars]
|
Adjustments for the Vagrant VM settings [silke, eelcomaljaars]
|
||||||
|
@ -12,22 +66,22 @@ Version 3.5.1 (2017-03-12)
|
||||||
Improvements to the API and Friendica specific extensions [gerhard6380]
|
Improvements to the API and Friendica specific extensions [gerhard6380]
|
||||||
Improvements to the Browser Notification functionality [Hypolite]
|
Improvements to the Browser Notification functionality [Hypolite]
|
||||||
Improvements to the themes [Hypolite, rabuzarus, rebeka-catalina, tobiasd]
|
Improvements to the themes [Hypolite, rabuzarus, rebeka-catalina, tobiasd]
|
||||||
Improvements to the database handling [heluecht]
|
Improvements to the database handling [annando]
|
||||||
Improvements to the admin panel [tobiasd, Hypolite]
|
Improvements to the admin panel [tobiasd, Hypolite]
|
||||||
Improvements to the update process [heluecht]
|
Improvements to the update process [annando]
|
||||||
Improvements to the handling of worker processes [heluecht]
|
Improvements to the handling of worker processes [annando]
|
||||||
Improvements to the performance [heluecht, Hypolite]
|
Improvements to the performance [annando, Hypolite]
|
||||||
Improvements to the documentation [Hypolite, tobiasd, rabuzarus, beardyunixer, eelcomaljaars]
|
Improvements to the documentation [Hypolite, tobiasd, rabuzarus, beardyunixer, eelcomaljaars]
|
||||||
Improvements to the BBCode / Markdown conversation [Hypolite]
|
Improvements to the BBCode / Markdown conversation [Hypolite]
|
||||||
Improvements to the OStatus protocol implementation [heluecht]
|
Improvements to the OStatus protocol implementation [annando]
|
||||||
Improvements to the installation wizzard [tobiasd]
|
Improvements to the installation wizzard [tobiasd]
|
||||||
Improvements to the Diaspora connectivity [heluecht, Hypolite]
|
Improvements to the Diaspora connectivity [annando, Hypolite]
|
||||||
Work on PHP7 compatibility [ddorian1]
|
Work on PHP7 compatibility [ddorian1]
|
||||||
Code cleanup [Hypolite, Quix0r]
|
Code cleanup [Hypolite, Quix0r]
|
||||||
Initial federation with Mastodon [heluecht]
|
Initial federation with Mastodon [annando]
|
||||||
The worker process can now also be started from the frontend [heluecht]
|
The worker process can now also be started from the frontend [annando]
|
||||||
Deletion of postings is now done in the background [heluecht]
|
Deletion of postings is now done in the background [annando]
|
||||||
Extension of the DFRN transmitted information fields [heluecht]
|
Extension of the DFRN transmitted information fields [annando]
|
||||||
Translations of the core are now in /view/lang [Hypolite, tobiasd]
|
Translations of the core are now in /view/lang [Hypolite, tobiasd]
|
||||||
Update of the fullCalendar library to 3.0.1 and adjusting the themes [rabuzarus]
|
Update of the fullCalendar library to 3.0.1 and adjusting the themes [rabuzarus]
|
||||||
ping now works with JSON as well [Hypolite]
|
ping now works with JSON as well [Hypolite]
|
||||||
|
@ -46,16 +100,16 @@ Version 3.5.1 (2017-03-12)
|
||||||
Updates to the translations (DE, ES, FR, IT, PT-BR) [translation teams]
|
Updates to the translations (DE, ES, FR, IT, PT-BR) [translation teams]
|
||||||
Improvements to the IFTTT addon [Hypolite]
|
Improvements to the IFTTT addon [Hypolite]
|
||||||
Improvements to the language filter addon [strk]
|
Improvements to the language filter addon [strk]
|
||||||
Improvements to the pump.io bridge [heluecht]
|
Improvements to the pump.io bridge [annando]
|
||||||
Improvements to the jappixmini addon [heluecht]
|
Improvements to the jappixmini addon [annando]
|
||||||
Improvements to the gpluspost addon [heluecht]
|
Improvements to the gpluspost addon [annando]
|
||||||
Improvements to the performance of the Twitter bridge when using workers [heluecht]
|
Improvements to the performance of the Twitter bridge when using workers [annando]
|
||||||
Diaspora Export addon is now working again [heluecht]
|
Diaspora Export addon is now working again [annando]
|
||||||
Pledgie badge now uses https protocol for embedding [tobiasd]
|
Pledgie badge now uses https protocol for embedding [tobiasd]
|
||||||
Better posting loop prevention for the Google+/Twitter/GS connectors [heluecht]
|
Better posting loop prevention for the Google+/Twitter/GS connectors [annando]
|
||||||
One can now configure the message for wppost bridged blog postings [tobiasd]
|
One can now configure the message for wppost bridged blog postings [tobiasd]
|
||||||
On some pages the result of the Rendertime is not shown anymore [heluecht]
|
On some pages the result of the Rendertime is not shown anymore [annando]
|
||||||
Twitter-bridge now supports quotes and long posts when importing tweets [heluecht]
|
Twitter-bridge now supports quotes and long posts when importing tweets [annando]
|
||||||
|
|
||||||
Closed Issues
|
Closed Issues
|
||||||
1019, 1163, 1612, 1613, 2103, 2177, 2252, 2260, 2403, 2991, 2614,
|
1019, 1163, 1612, 1613, 2103, 2177, 2252, 2260, 2403, 2991, 2614,
|
||||||
|
@ -67,48 +121,48 @@ Version 3.5.1 (2017-03-12)
|
||||||
|
|
||||||
Version 3.5 (2016-09-13)
|
Version 3.5 (2016-09-13)
|
||||||
Friendica Core:
|
Friendica Core:
|
||||||
NEW Optional local directory with possible federated contacts [heluecht]
|
NEW Optional local directory with possible federated contacts [annando]
|
||||||
NEW Autocompletion for @-mentions and BBCode tags [rabuzarus]
|
NEW Autocompletion for @-mentions and BBCode tags [rabuzarus]
|
||||||
NEW Added a composer derived autoloader which allows composer autoloaders in addons/libraries [fabrixxm]
|
NEW Added a composer derived autoloader which allows composer autoloaders in addons/libraries [fabrixxm]
|
||||||
NEW theme: frio [rabuzarus, heluecht, fabrixxm]
|
NEW theme: frio [rabuzarus, annando, fabrixxm]
|
||||||
Enhance .htaccess file (nerdoc, dissolve)
|
Enhance .htaccess file (nerdoc, dissolve)
|
||||||
Updates to the translations (DE, ES, IS, IT, RU) [translation teams]
|
Updates to the translations (DE, ES, IS, IT, RU) [translation teams]
|
||||||
Updates to the documentation [tobiasd, heluecht, mexcon, silke, rabuzarus, fabrixxm, Olivier Mehani, gerhard6380, ben utzer]
|
Updates to the documentation [tobiasd, annando, mexcon, silke, rabuzarus, fabrixxm, Olivier Mehani, gerhard6380, ben utzer]
|
||||||
Extended the BBCode by [abstract] tag used for bridged postings to networks with limited character length [heluecht]
|
Extended the BBCode by [abstract] tag used for bridged postings to networks with limited character length [annando]
|
||||||
Code cleanup [heluecht, QuixOr]
|
Code cleanup [annando, QuixOr]
|
||||||
Improvements to the API and Friendica specific extensions [heluecht, fabrixxm, gerhard6380]
|
Improvements to the API and Friendica specific extensions [annando, fabrixxm, gerhard6380]
|
||||||
Improvements to the RSS/Atom feed import [mexcon]
|
Improvements to the RSS/Atom feed import [mexcon]
|
||||||
Improvements to the communication with federated networks (Diaspora, Hubzilla, OStatus) [heluecht]
|
Improvements to the communication with federated networks (Diaspora, Hubzilla, OStatus) [annando]
|
||||||
Improvements on the themes (quattro, vier, frost) [rabuzarus, fabrixxm, stieben, heluecht, Quix0r, tobiasd]
|
Improvements on the themes (quattro, vier, frost) [rabuzarus, fabrixxm, stieben, annando, Quix0r, tobiasd]
|
||||||
Improvements to the ACL dialog [fabrixxm, rabuzarus]
|
Improvements to the ACL dialog [fabrixxm, rabuzarus]
|
||||||
Improvements to the database structure and optimization of queries [heluecht]
|
Improvements to the database structure and optimization of queries [annando]
|
||||||
Improvements to the UI (contacts, hotkeys, remember me, ARIA, code hightlighting) [rabuzarus, heluecht, tobiasd]
|
Improvements to the UI (contacts, hotkeys, remember me, ARIA, code hightlighting) [rabuzarus, annando, tobiasd]
|
||||||
Improvements to the background process (poller, worker) [heluecht]
|
Improvements to the background process (poller, worker) [annando]
|
||||||
Improvements to the admin panel [tobiasd, heluecht, fabrixxm]
|
Improvements to the admin panel [tobiasd, annando, fabrixxm]
|
||||||
Improvements to the performance [heluecht]
|
Improvements to the performance [annando]
|
||||||
Improvements to the installation wizzard (language selection, RINO version, check required PHP modules, default theme is now vier) [tobiasd]
|
Improvements to the installation wizzard (language selection, RINO version, check required PHP modules, default theme is now vier) [tobiasd]
|
||||||
Improvements to the relocation of nodes and accounts [heluecht]
|
Improvements to the relocation of nodes and accounts [annando]
|
||||||
Improvements to the DDoS detection [heluecht]
|
Improvements to the DDoS detection [annando]
|
||||||
Improvements to the calendar/events module [heluecht, rabuzarus]
|
Improvements to the calendar/events module [annando, rabuzarus]
|
||||||
Improvements to OpenID login [strk]
|
Improvements to OpenID login [strk]
|
||||||
Improvements to the ShaShape font [andi]
|
Improvements to the ShaShape font [andi]
|
||||||
Reworked the implementation of the DFRN, Diaspora protocols [heluecht]
|
Reworked the implementation of the DFRN, Diaspora protocols [annando]
|
||||||
Reworked the notifications code [fabrixxm, rabuzarus, heluecht]
|
Reworked the notifications code [fabrixxm, rabuzarus, annando]
|
||||||
Reworked the p/config code [fabrixxm, rabuzarus]
|
Reworked the p/config code [fabrixxm, rabuzarus]
|
||||||
Reworked XML generation [heluecht]
|
Reworked XML generation [annando]
|
||||||
Removed now unused simplepie from library [heluecht]
|
Removed now unused simplepie from library [annando]
|
||||||
|
|
||||||
Friendica Addons
|
Friendica Addons
|
||||||
Updated to the translations (DE, ES, IS, NL, PT BR), [translation teams]
|
Updated to the translations (DE, ES, IS, NL, PT BR), [translation teams]
|
||||||
Piwik [tobiasd]
|
Piwik [tobiasd]
|
||||||
Twitter Connector [heluecht]
|
Twitter Connector [annando]
|
||||||
Pumpio Connector [heluecht]
|
Pumpio Connector [annando]
|
||||||
Rendertime [heluecht]
|
Rendertime [annando]
|
||||||
wppost [heluecht]
|
wppost [annando]
|
||||||
showmore [rabuzarus]
|
showmore [rabuzarus]
|
||||||
fromgplus [heluecht]
|
fromgplus [annando]
|
||||||
app.net Connector [heluecht]
|
app.net Connector [annando]
|
||||||
GNU Social Connector [heluecht]
|
GNU Social Connector [annando]
|
||||||
LDAP [Olivier Mehani]
|
LDAP [Olivier Mehani]
|
||||||
smileybutton [rabuzarus]
|
smileybutton [rabuzarus]
|
||||||
retriver [mexon]
|
retriver [mexon]
|
||||||
|
|
11
INSTALL.txt
11
INSTALL.txt
|
@ -71,9 +71,14 @@ write or create files in your web directory, create an empty file called
|
||||||
.htconfig.php and make it writable by the web server.
|
.htconfig.php and make it writable by the web server.
|
||||||
|
|
||||||
5. Visit your website with a web browser and follow the instructions. Please
|
5. Visit your website with a web browser and follow the instructions. Please
|
||||||
note any error messages and correct these before continuing. If you are using
|
note any error messages and correct these before continuing.
|
||||||
SSL with a known signature authority (recommended), use the https: link to your
|
|
||||||
website. If you are using a self-signed cert or no cert, use the http: link.
|
If you are using SSL with a known signature authority (recommended), use the
|
||||||
|
https: link to your website. If you are using a self-signed cert or no cert,
|
||||||
|
use the http: link.
|
||||||
|
|
||||||
|
If you need to specify a port for the connection to the database, you can do
|
||||||
|
so in the host name setting for the database.
|
||||||
|
|
||||||
6. *If* the automated installation fails for any reason, check the following:
|
6. *If* the automated installation fails for any reason, check the following:
|
||||||
|
|
||||||
|
|
50
boot.php
50
boot.php
|
@ -35,12 +35,13 @@ require_once 'include/features.php';
|
||||||
require_once 'include/identity.php';
|
require_once 'include/identity.php';
|
||||||
require_once 'update.php';
|
require_once 'update.php';
|
||||||
require_once 'include/dbstructure.php';
|
require_once 'include/dbstructure.php';
|
||||||
|
require_once 'include/poller.php';
|
||||||
|
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define ( 'FRIENDICA_VERSION', '3.5.2-dev' );
|
define ( 'FRIENDICA_VERSION', '3.5.3-dev' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1224 );
|
define ( 'DB_UPDATE_VERSION', 1229 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
@ -457,6 +458,13 @@ if (!defined("SIGTERM")) {
|
||||||
define("SIGTERM", 15);
|
define("SIGTERM", 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Depending on the PHP version this constant does exist - or not.
|
||||||
|
* See here: http://php.net/manual/en/curl.constants.php#117928
|
||||||
|
*/
|
||||||
|
if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
||||||
|
define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
||||||
|
@ -985,7 +993,7 @@ function notice($s) {
|
||||||
function info($s) {
|
function info($s) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if (local_user() AND get_pconfig(local_user(), 'system', 'ignore_info')) {
|
if (local_user() && get_pconfig(local_user(), 'system', 'ignore_info')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1055,7 +1063,7 @@ function proc_run($cmd) {
|
||||||
$arr = array('args' => $args, 'run_cmd' => true);
|
$arr = array('args' => $args, 'run_cmd' => true);
|
||||||
|
|
||||||
call_hooks("proc_run", $arr);
|
call_hooks("proc_run", $arr);
|
||||||
if (!$arr['run_cmd'] OR ! count($args)) {
|
if (!$arr['run_cmd'] || ! count($args)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1088,18 +1096,8 @@ function proc_run($cmd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checking number of workers
|
|
||||||
$workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` > '%s'", dbesc(NULL_DATE));
|
|
||||||
|
|
||||||
// Get number of allowed number of worker threads
|
|
||||||
$queues = intval(get_config("system", "worker_queues"));
|
|
||||||
|
|
||||||
if ($queues == 0) {
|
|
||||||
$queues = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are already enough workers running, don't fork another one
|
// If there are already enough workers running, don't fork another one
|
||||||
if ($workers[0]["workers"] >= $queues) {
|
if (poller_too_much_workers()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1375,7 +1373,7 @@ function get_server() {
|
||||||
$server = get_config("system", "directory");
|
$server = get_config("system", "directory");
|
||||||
|
|
||||||
if ($server == "") {
|
if ($server == "") {
|
||||||
$server = "http://dir.friendi.ca";
|
$server = "http://dir.friendica.social";
|
||||||
}
|
}
|
||||||
|
|
||||||
return($server);
|
return($server);
|
||||||
|
@ -1409,7 +1407,7 @@ function clear_cache($basepath = "", $path = "") {
|
||||||
$path = $basepath;
|
$path = $basepath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($path == "") OR (!is_dir($path))) {
|
if (($path == "") || (!is_dir($path))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,10 +1424,10 @@ function clear_cache($basepath = "", $path = "") {
|
||||||
if ($dh = opendir($path)) {
|
if ($dh = opendir($path)) {
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
$fullpath = $path . "/" . $file;
|
$fullpath = $path . "/" . $file;
|
||||||
if ((filetype($fullpath) == "dir") and ($file != ".") and ($file != "..")) {
|
if ((filetype($fullpath) == "dir") && ($file != ".") && ($file != "..")) {
|
||||||
clear_cache($basepath, $fullpath);
|
clear_cache($basepath, $fullpath);
|
||||||
}
|
}
|
||||||
if ((filetype($fullpath) == "file") and (filectime($fullpath) < (time() - $cachetime))) {
|
if ((filetype($fullpath) == "file") && (filectime($fullpath) < (time() - $cachetime))) {
|
||||||
unlink($fullpath);
|
unlink($fullpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1444,7 @@ function get_itemcachepath() {
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemcache = get_config('system', 'itemcache');
|
$itemcache = get_config('system', 'itemcache');
|
||||||
if (($itemcache != "") AND App::directory_usable($itemcache)) {
|
if (($itemcache != "") && App::directory_usable($itemcache)) {
|
||||||
return $itemcache;
|
return $itemcache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1473,7 +1471,7 @@ function get_itemcachepath() {
|
||||||
*/
|
*/
|
||||||
function get_spoolpath() {
|
function get_spoolpath() {
|
||||||
$spoolpath = get_config('system', 'spoolpath');
|
$spoolpath = get_config('system', 'spoolpath');
|
||||||
if (($spoolpath != "") AND App::directory_usable($spoolpath)) {
|
if (($spoolpath != "") && App::directory_usable($spoolpath)) {
|
||||||
// We have a spool path and it is usable
|
// We have a spool path and it is usable
|
||||||
return $spoolpath;
|
return $spoolpath;
|
||||||
}
|
}
|
||||||
|
@ -1508,7 +1506,7 @@ function get_temppath() {
|
||||||
|
|
||||||
$temppath = get_config("system", "temppath");
|
$temppath = get_config("system", "temppath");
|
||||||
|
|
||||||
if (($temppath != "") AND App::directory_usable($temppath)) {
|
if (($temppath != "") && App::directory_usable($temppath)) {
|
||||||
// We have a temp path and it is usable
|
// We have a temp path and it is usable
|
||||||
return $temppath;
|
return $temppath;
|
||||||
}
|
}
|
||||||
|
@ -1517,7 +1515,7 @@ function get_temppath() {
|
||||||
$temppath = sys_get_temp_dir();
|
$temppath = sys_get_temp_dir();
|
||||||
|
|
||||||
// Check if it is usable
|
// Check if it is usable
|
||||||
if (($temppath != "") AND App::directory_usable($temppath)) {
|
if (($temppath != "") && App::directory_usable($temppath)) {
|
||||||
// To avoid any interferences with other systems we create our own directory
|
// To avoid any interferences with other systems we create our own directory
|
||||||
$new_temppath = $temppath . "/" . $a->get_hostname();
|
$new_temppath = $temppath . "/" . $a->get_hostname();
|
||||||
if (!is_dir($new_temppath)) {
|
if (!is_dir($new_temppath)) {
|
||||||
|
@ -1640,7 +1638,7 @@ function argv($x) {
|
||||||
function infinite_scroll_data($module) {
|
function infinite_scroll_data($module) {
|
||||||
|
|
||||||
if (get_pconfig(local_user(), 'system', 'infinite_scroll')
|
if (get_pconfig(local_user(), 'system', 'infinite_scroll')
|
||||||
AND ($module == "network") AND ($_GET["mode"] != "minimal")) {
|
&& ($module == "network") && ($_GET["mode"] != "minimal")) {
|
||||||
|
|
||||||
// get the page number
|
// get the page number
|
||||||
if (is_string($_GET["page"])) {
|
if (is_string($_GET["page"])) {
|
||||||
|
@ -1653,12 +1651,12 @@ function infinite_scroll_data($module) {
|
||||||
|
|
||||||
// try to get the uri from which we load the content
|
// try to get the uri from which we load the content
|
||||||
foreach ($_GET AS $param => $value) {
|
foreach ($_GET AS $param => $value) {
|
||||||
if (($param != "page") AND ($param != "q")) {
|
if (($param != "page") && ($param != "q")) {
|
||||||
$reload_uri .= "&" . $param . "=" . urlencode($value);
|
$reload_uri .= "&" . $param . "=" . urlencode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($a->page_offset != "") AND ! strstr($reload_uri, "&offset=")) {
|
if (($a->page_offset != "") && ! strstr($reload_uri, "&offset=")) {
|
||||||
$reload_uri .= "&offset=" . urlencode($a->page_offset);
|
$reload_uri .= "&offset=" . urlencode($a->page_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
29
database.sql
29
database.sql
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 3.5.2-dev (Asparagus)
|
-- Friendica 3.5.3dev (Asparagus)
|
||||||
-- DB_UPDATE_VERSION 1221
|
-- DB_UPDATE_VERSION 1228
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
||||||
--
|
--
|
||||||
CREATE TABLE IF NOT EXISTS `conv` (
|
CREATE TABLE IF NOT EXISTS `conv` (
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
`id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||||
`recips` text,
|
`recips` text,
|
||||||
`uid` int(11) NOT NULL DEFAULT 0,
|
`uid` int(11) NOT NULL DEFAULT 0,
|
||||||
`creator` varchar(255) NOT NULL DEFAULT '',
|
`creator` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
@ -270,7 +270,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
|
||||||
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `addr` (`addr`(32)),
|
INDEX `addr` (`addr`(32)),
|
||||||
INDEX `url` (`url`)
|
UNIQUE INDEX `url` (`url`(190))
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -355,7 +355,7 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
|
||||||
`generation` tinyint(3) NOT NULL DEFAULT 0,
|
`generation` tinyint(3) NOT NULL DEFAULT 0,
|
||||||
`server_url` varchar(255) NOT NULL DEFAULT '',
|
`server_url` varchar(255) NOT NULL DEFAULT '',
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `nurl` (`nurl`(64)),
|
UNIQUE INDEX `nurl` (`nurl`(190)),
|
||||||
INDEX `name` (`name`(64)),
|
INDEX `name` (`name`(64)),
|
||||||
INDEX `nick` (`nick`(32)),
|
INDEX `nick` (`nick`(32)),
|
||||||
INDEX `addr` (`addr`(64)),
|
INDEX `addr` (`addr`(64)),
|
||||||
|
@ -425,7 +425,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
|
||||||
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
|
`last_contact` datetime DEFAULT '0001-01-01 00:00:00',
|
||||||
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
|
`last_failure` datetime DEFAULT '0001-01-01 00:00:00',
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `nurl` (`nurl`(32))
|
UNIQUE INDEX `nurl` (`nurl`(190))
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -544,6 +544,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
|
INDEX `uid_parenturi` (`uid`,`parent-uri`(190)),
|
||||||
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
||||||
INDEX `authorid_created` (`author-id`,`created`),
|
INDEX `authorid_created` (`author-id`,`created`),
|
||||||
|
INDEX `ownerid` (`owner-id`),
|
||||||
INDEX `uid_uri` (`uid`,`uri`(190)),
|
INDEX `uid_uri` (`uid`,`uri`(190)),
|
||||||
INDEX `resource-id` (`resource-id`),
|
INDEX `resource-id` (`resource-id`),
|
||||||
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
|
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
|
||||||
|
@ -579,7 +580,7 @@ CREATE TABLE IF NOT EXISTS `locks` (
|
||||||
`id` int(11) NOT NULL auto_increment,
|
`id` int(11) NOT NULL auto_increment,
|
||||||
`name` varchar(128) NOT NULL DEFAULT '',
|
`name` varchar(128) NOT NULL DEFAULT '',
|
||||||
`locked` tinyint(1) NOT NULL DEFAULT 0,
|
`locked` tinyint(1) NOT NULL DEFAULT 0,
|
||||||
`created` datetime DEFAULT '0001-01-01 00:00:00',
|
`pid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
|
@ -589,7 +590,7 @@ CREATE TABLE IF NOT EXISTS `locks` (
|
||||||
CREATE TABLE IF NOT EXISTS `mail` (
|
CREATE TABLE IF NOT EXISTS `mail` (
|
||||||
`id` int(10) unsigned NOT NULL auto_increment,
|
`id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
`uid` int(10) unsigned NOT NULL DEFAULT 0,
|
||||||
`guid` varchar(64) NOT NULL DEFAULT '',
|
`guid` varchar(255) NOT NULL DEFAULT '',
|
||||||
`from-name` varchar(255) NOT NULL DEFAULT '',
|
`from-name` varchar(255) NOT NULL DEFAULT '',
|
||||||
`from-photo` varchar(255) NOT NULL DEFAULT '',
|
`from-photo` varchar(255) NOT NULL DEFAULT '',
|
||||||
`from-url` varchar(255) NOT NULL DEFAULT '',
|
`from-url` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
@ -608,7 +609,8 @@ CREATE TABLE IF NOT EXISTS `mail` (
|
||||||
INDEX `uid_seen` (`uid`,`seen`),
|
INDEX `uid_seen` (`uid`,`seen`),
|
||||||
INDEX `convid` (`convid`),
|
INDEX `convid` (`convid`),
|
||||||
INDEX `uri` (`uri`(64)),
|
INDEX `uri` (`uri`(64)),
|
||||||
INDEX `parent-uri` (`parent-uri`(64))
|
INDEX `parent-uri` (`parent-uri`(64)),
|
||||||
|
INDEX `contactid` (`contact-id`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -746,6 +748,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
|
||||||
`deny_cid` mediumtext,
|
`deny_cid` mediumtext,
|
||||||
`deny_gid` mediumtext,
|
`deny_gid` mediumtext,
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
|
INDEX `contactid` (`contact-id`),
|
||||||
INDEX `uid_contactid` (`uid`,`contact-id`),
|
INDEX `uid_contactid` (`uid`,`contact-id`),
|
||||||
INDEX `uid_profile` (`uid`,`profile`),
|
INDEX `uid_profile` (`uid`,`profile`),
|
||||||
INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
|
INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
|
||||||
|
@ -1019,6 +1022,9 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
||||||
INDEX `uid_network_created` (`uid`,`network`,`created`),
|
INDEX `uid_network_created` (`uid`,`network`,`created`),
|
||||||
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
|
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
|
||||||
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
||||||
|
INDEX `contactid` (`contact-id`),
|
||||||
|
INDEX `ownerid` (`owner-id`),
|
||||||
|
INDEX `authorid` (`author-id`),
|
||||||
INDEX `uid_created` (`uid`,`created`),
|
INDEX `uid_created` (`uid`,`created`),
|
||||||
INDEX `uid_commented` (`uid`,`commented`),
|
INDEX `uid_commented` (`uid`,`commented`),
|
||||||
INDEX `uid_wall_created` (`uid`,`wall`,`created`)
|
INDEX `uid_wall_created` (`uid`,`wall`,`created`)
|
||||||
|
@ -1108,6 +1114,9 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
|
||||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
`pid` int(11) NOT NULL DEFAULT 0,
|
`pid` int(11) NOT NULL DEFAULT 0,
|
||||||
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
|
||||||
PRIMARY KEY(`id`)
|
PRIMARY KEY(`id`),
|
||||||
|
INDEX `pid` (`pid`),
|
||||||
|
INDEX `parameter` (`parameter`(192)),
|
||||||
|
INDEX `priority_created` (`priority`,`created`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ Not all Friendica sites allow open registration.
|
||||||
If registration is allowed, you will see a "Register" link immediately below the login prompt on the site home page.
|
If registration is allowed, you will see a "Register" link immediately below the login prompt on the site home page.
|
||||||
Following this link will take you to the site registration page.
|
Following this link will take you to the site registration page.
|
||||||
The strength of our network is that lots of different sites are all completely compatible with each other.
|
The strength of our network is that lots of different sites are all completely compatible with each other.
|
||||||
If the site you're visting doesn't allow registration, or you think you might prefer another one, you can find a [list of public servers here](http://dir.friendica.com/siteinfo), and find one that meets your needs.
|
If the site you're visting doesn't allow registration, or you think you might prefer another one, you can find a [list of public servers here](https://dir.friendica.social/servers), and find one that meets your needs.
|
||||||
|
|
||||||
If you'd like to have your own server, you can do that too.
|
If you'd like to have your own server, you can do that too.
|
||||||
Visit [the Friendica website](http://friendica.com/download) to download the code with setup instructions.
|
Visit [the Friendica website](http://friendi.ca/) to download the code with setup instructions.
|
||||||
It's a very simple installation process that anybody experienced in hosting websites, or with basic Linux experience can handle easily.
|
It's a very simple installation process that anybody experienced in hosting websites, or with basic Linux experience can handle easily.
|
||||||
|
|
||||||
###OpenID
|
###OpenID
|
||||||
|
|
|
@ -61,17 +61,17 @@ table.bbcodes > * > tr > th {
|
||||||
<td><span style="color: red;">red</span></td>
|
<td><span style="color: red;">red</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=http://www.friendica.com]Friendica[/url]</td>
|
<td>[url=http://friendi.ca]Friendica[/url]</td>
|
||||||
<td><a href="http://www.friendica.com" target="external-link">Friendica</a></td>
|
<td><a href="http://friendi.ca" target="external-link">Friendica</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[img]http://friendica.com/sites/default/files/friendika-32.png[/img]</td>
|
<td>[img]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]</td>
|
||||||
<td><img src="http://friendica.com/sites/default/files/friendika-32.png" alt="Immagine/foto"></td>
|
<td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" alt="Immagine/foto"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[img=64x32]http://friendica.com/sites/default/files/friendika-32.png[/img]<br>
|
<td>[img=64x32]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]<br>
|
||||||
<br>Note: provided height is simply discarded.</td>
|
<br>Note: provided height is simply discarded.</td>
|
||||||
<td><img src="http://friendica.com/sites/default/files/friendika-32.png" style="width: 64px;"></td>
|
<td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" style="width: 64px;"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[size=xx-small]small text[/size]</td>
|
<td>[size=xx-small]small text[/size]</td>
|
||||||
|
@ -82,7 +82,7 @@ table.bbcodes > * > tr > th {
|
||||||
<td><span style="font-size: xx-large;">big text</span></td>
|
<td><span style="font-size: xx-large;">big text</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[size=20]exact size[/size] (size can be any number, in pixel)</td>
|
<td>[size=20]exact size[/size] (size can be any number, in pixels)</td>
|
||||||
<td><span style="font-size: 20px;">exact size</span></td>
|
<td><span style="font-size: 20px;">exact size</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -99,23 +99,23 @@ table.bbcodes > * > tr > th {
|
||||||
<th>Result</th>
|
<th>Result</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url]http://friendica.com[/url]</td>
|
<td>[url]http://friendi.ca[/url]</td>
|
||||||
<td><a href="http://friendica.com">http://friendica.com</a></td>
|
<td><a href="http://friendi.ca">http://friendi.ca</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=http://friendica.com]Friendica[/url]</td>
|
<td>[url=http://friendi.ca]Friendica[/url]</td>
|
||||||
<td><a href="http://friendica.com">Friendica</a></td>
|
<td><a href="http://friendi.ca">Friendica</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[bookmark]http://friendica.com[/bookmark]<br><br>
|
<td>[bookmark]http://friendi.ca[/bookmark]<br><br>
|
||||||
#^[url]http://friendica.com[/url]</td>
|
#^[url]http://friendi.ca[/url]</td>
|
||||||
<td><span class="oembed link"><h4>Friendica: <a href="http://friendica.com" rel="oembed"></a><a href="http://friendica.com" target="_blank">http://friendica.com</a></h4></span></td>
|
<td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">http://friendi.ca</a></h4></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[bookmark=http://friendica.com]Bookmark[/bookmark]<br><br>
|
<td>[bookmark=http://friendi.ca]Bookmark[/bookmark]<br><br>
|
||||||
#^[url=http://friendica.com]Bookmark[/url]<br><br>
|
#^[url=http://friendi.ca]Bookmark[/url]<br><br>
|
||||||
#[url=http://friendica.com]^[/url][url=http://friendica.com]Bookmark[/url]</td>
|
#[url=http://friendi.ca]^[/url][url=http://friendi.ca]Bookmark[/url]</td>
|
||||||
<td><span class="oembed link"><h4>Friendica: <a href="http://friendica.com" rel="oembed"></a><a href="http://friendica.com" target="_blank">Bookmark</a></h4></span></td>
|
<td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">Bookmark</a></h4></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora post with GUID[/url]</td>
|
<td>[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora post with GUID[/url]</td>
|
||||||
|
@ -490,7 +490,7 @@ Page title with a link to *url* will be shown.</td>
|
||||||
|
|
||||||
## Map
|
## Map
|
||||||
|
|
||||||
This require "openstreetmap" or "Google Maps" addon version 1.3 or newer.
|
This requires "openstreetmap" or "Google Maps" addon version 1.3 or newer.
|
||||||
If the addon isn't activated, the raw coordinates are shown instead.
|
If the addon isn't activated, the raw coordinates are shown instead.
|
||||||
|
|
||||||
<table class="bbcodes">
|
<table class="bbcodes">
|
||||||
|
@ -514,10 +514,10 @@ If the addon isn't activated, the raw coordinates are shown instead.
|
||||||
|
|
||||||
## Abstract for longer posts
|
## Abstract for longer posts
|
||||||
|
|
||||||
If you want to spread your post to several third party networks you can have the problem that these networks have a length limitation like on Twitter.
|
If you want to spread your post to several third party networks you may have the problem that these networks have a length limitation like on Twitter.
|
||||||
|
|
||||||
Friendica is using a semi intelligent mechanism to generate a fitting abstract.
|
Friendica uses a semi-intelligent mechanism to generate a fitting abstract.
|
||||||
But it can be interesting to define a custom abstract that will only be displayed on the external network.
|
But it can be useful to define a custom abstract that will only be displayed on the external network.
|
||||||
This is done with the [abstract]-element.
|
This is done with the [abstract]-element.
|
||||||
<table class="bbcodes">
|
<table class="bbcodes">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -566,7 +566,7 @@ Instead you have to name the explicit network:
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
[abstract]These days I had a strange encounter...[/abstract]<br>
|
[abstract]These days I had a strange encounter...[/abstract]<br>
|
||||||
[abstract=goog]Helly my dear Google+ followers. You have to read my newest blog post![/abstract]<br>
|
[abstract=goog]Hello my dear Google+ followers. You have to read my newest blog post![/abstract]<br>
|
||||||
[abstract=face]Hello my Facebook friends. These days happened something really cool.[/abstract]<br>
|
[abstract=face]Hello my Facebook friends. These days happened something really cool.[/abstract]<br>
|
||||||
While taking pictures in the woods I had a really strange encounter...</td>
|
While taking pictures in the woods I had a really strange encounter...</td>
|
||||||
<td>Google and Facebook will show the respective abstracts while the other networks will show the default one.<br>
|
<td>Google and Facebook will show the respective abstracts while the other networks will show the default one.<br>
|
||||||
|
@ -574,7 +574,7 @@ While taking pictures in the woods I had a really strange encounter...</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
The [abstract] element isn't working with connectors where we post the HTML like Tumblr, Wordpress or Pump.io.
|
The [abstract] element is not working with connectors where we post HTML directly, like Tumblr, Wordpress or Pump.io.
|
||||||
For the native connections--that is to e.g. Friendica, Hubzilla, Diaspora or GNU Social--the full posting is used and the contacts instance will display the posting as desired.
|
For the native connections--that is to e.g. Friendica, Hubzilla, Diaspora or GNU Social--the full posting is used and the contacts instance will display the posting as desired.
|
||||||
|
|
||||||
## Special
|
## Special
|
||||||
|
|
|
@ -5,9 +5,9 @@ Bugs and Issues
|
||||||
|
|
||||||
If your server has a support page, you should report any bugs/issues you encounter there first.
|
If your server has a support page, you should report any bugs/issues you encounter there first.
|
||||||
Reporting to your support page before reporting to the developers makes their job easier, as they don't have to deal with bug reports that might not have anything to do with them.
|
Reporting to your support page before reporting to the developers makes their job easier, as they don't have to deal with bug reports that might not have anything to do with them.
|
||||||
This helps us get new features faster.
|
Reducing the workload in this way helps us get new features faster.
|
||||||
You can also contact the [friendica support forum](https://helpers.pyxis.uberspace.de/profile/helpers) and report your problem there.
|
You can also contact the [friendica support forum](https://helpers.pyxis.uberspace.de/profile/helpers) and report your problem there.
|
||||||
Maybe someone from another node encountered the problem as well and can help you.
|
Bugs are rarely limited to one person, and the chances are somebody from another node has encountered the problem too, and will be able to help you.
|
||||||
|
|
||||||
If you're a technical user, or your site doesn't have a support page, you'll need to use the [Bug Tracker](https://github.com/friendica/friendica/issues).
|
If you're a technical user, or your site doesn't have a support page, you'll need to use the [Bug Tracker](https://github.com/friendica/friendica/issues).
|
||||||
Please perform a search to see if there's already an open bug that matches yours before submitting anything.
|
Please perform a search to see if there's already an open bug that matches yours before submitting anything.
|
||||||
|
@ -15,6 +15,6 @@ Please perform a search to see if there's already an open bug that matches yours
|
||||||
Try to provide as much information as you can about the bug, including the **full** text of any error messages or notices, and any steps required to replicate the problem in as much detail as possible.
|
Try to provide as much information as you can about the bug, including the **full** text of any error messages or notices, and any steps required to replicate the problem in as much detail as possible.
|
||||||
It's generally better to provide too much information than not enough.
|
It's generally better to provide too much information than not enough.
|
||||||
|
|
||||||
See [this article](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) to learn more about submitting **good** bug reports.
|
See [this article](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html) to learn more about submitting **good** bug reports. The better your bug report, the more likely we are to be able to actually fix it.
|
||||||
|
|
||||||
And last but not least: Better report an issue you encountered even if you don't write the perfect bug report!
|
And last but not least: It is better to report an issue you encountered even if you can't write the perfect bug report!
|
10
doc/Chats.md
10
doc/Chats.md
|
@ -3,7 +3,7 @@ Chats
|
||||||
|
|
||||||
* [Home](help)
|
* [Home](help)
|
||||||
|
|
||||||
There are two possibilities to use a chat on your friendica site
|
There are two possibilities to use chat on your friendica site
|
||||||
|
|
||||||
* IRC Chat
|
* IRC Chat
|
||||||
* Jappix
|
* Jappix
|
||||||
|
@ -14,13 +14,13 @@ IRC-Chat Plugin
|
||||||
After activating the plugin, you can find the chat at [yoursite.com/irc](../irc).
|
After activating the plugin, you can find the chat at [yoursite.com/irc](../irc).
|
||||||
Note: you can use this chat without any login at your site so that everyone could use it.
|
Note: you can use this chat without any login at your site so that everyone could use it.
|
||||||
|
|
||||||
If you follow the link, you will see the login page of the IR chat.
|
If you follow the link, you will see the login page of the IRC chat.
|
||||||
Now choose a nickname and a chatroom.
|
Now choose a nickname and a chatroom.
|
||||||
You can choose every name for the room, even something like #superchatwhosenameisonlyknownbyme.
|
You can choose any name you like for the room, even something like #superchatwhosenameisonlyknownbyme.
|
||||||
At last, solve the captchas and click the connect button.
|
Finally, solve the captchas and click the connect button.
|
||||||
|
|
||||||
The following window shows some text while connecting.
|
The following window shows some text while connecting.
|
||||||
This text isn't importend for you, just wait for the next window.
|
This text isn't important, just wait for the next window.
|
||||||
The first line shows your name and your current IP address.
|
The first line shows your name and your current IP address.
|
||||||
The right part of the window shows all users.
|
The right part of the window shows all users.
|
||||||
The lower part of the window contains an input field.
|
The lower part of the window contains an input field.
|
||||||
|
|
|
@ -64,6 +64,7 @@ Here's a few primers if you are new to Friendica or to the PSR-2 coding standard
|
||||||
* By default, strings are enclosed in single quotes, but feel free to use double quotes if it makes more sense (SQL queries, adding tabs and line feeds).
|
* By default, strings are enclosed in single quotes, but feel free to use double quotes if it makes more sense (SQL queries, adding tabs and line feeds).
|
||||||
* Operators are wrapped by spaces, e.g. `$var === true`, `$var = 1 + 2` and `'string' . $concat . 'enation'`
|
* Operators are wrapped by spaces, e.g. `$var === true`, `$var = 1 + 2` and `'string' . $concat . 'enation'`
|
||||||
* Braces are mandatory in conditions
|
* Braces are mandatory in conditions
|
||||||
|
* Boolean operators are `&&` and `||` for PHP conditions, `AND` and `OR` for SQL queries
|
||||||
* No closing PHP tag
|
* No closing PHP tag
|
||||||
* No trailing spaces
|
* No trailing spaces
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ Depending on the features of the client you might encounter some glitches in usa
|
||||||
###Where I can find help?
|
###Where I can find help?
|
||||||
|
|
||||||
If you have problems with your Friendica page, you can ask the community at the [Friendica Support Group](https://helpers.pyxis.uberspace.de/profile/helpers).
|
If you have problems with your Friendica page, you can ask the community at the [Friendica Support Group](https://helpers.pyxis.uberspace.de/profile/helpers).
|
||||||
If you can't use your default profile you can either use a test account [test server](http://friendica.com/node/31) respectively an account at a public site [list](http://dir.friendica.com/siteinfo) or you can use the Librelist mailing list.
|
If you can't use your default profile you can use an account at a public site [list](https://dir.friendica.social/servers) or you can use the Librelist mailing list.
|
||||||
If you want to use the mailing list, please just send a mail to friendica AT librelist DOT com.
|
If you want to use the mailing list, please just send a mail to friendica AT librelist DOT com.
|
||||||
|
|
||||||
If you are a theme developer, you will find help at this forum: [Friendica Theme Developers](https://friendica.eu/profile/ftdevs).
|
If you are a theme developer, you will find help at this forum: [Friendica Theme Developers](https://friendica.eu/profile/ftdevs).
|
||||||
|
@ -188,7 +188,7 @@ Admin
|
||||||
|
|
||||||
###Can I configure multiple domains with the same code instance?
|
###Can I configure multiple domains with the same code instance?
|
||||||
|
|
||||||
No, this function is no longer supported from Friendica 3.3 onwards.
|
No, this function is no longer supported as of Friendica 3.3 onwards.
|
||||||
|
|
||||||
<a name="sources"></a>
|
<a name="sources"></a>
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ This is the default selection.
|
||||||
Community Forum/Celebrity Accounts provide the ability for people to become friends/fans of the forum without requiring approval.
|
Community Forum/Celebrity Accounts provide the ability for people to become friends/fans of the forum without requiring approval.
|
||||||
|
|
||||||
The exact setting you would use depends on how you wish to interact with people who join the page.
|
The exact setting you would use depends on how you wish to interact with people who join the page.
|
||||||
The "Soapbox" setting let's the page owner control all communications.
|
The "Soapbox" setting lets the page owner control all communications.
|
||||||
Everything you post will go out to the forum members, but there will be no opportunity for interaction.
|
Everything you post will go out to the forum members, but there will be no opportunity for interaction.
|
||||||
This setting would typically be used for announcements or corporate communications.
|
This setting would typically be used for announcements or corporate communications.
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ Restart mysql and you should be fine.
|
||||||
Point your web browser to the new site and follow the instructions.
|
Point your web browser to the new site and follow the instructions.
|
||||||
Please note any error messages and correct these before continuing.
|
Please note any error messages and correct these before continuing.
|
||||||
|
|
||||||
|
If you need to specify a port for the connection to the database, you can do so in the host name setting for the database.
|
||||||
|
|
||||||
*If* the automated installation fails for any reason, check the following:
|
*If* the automated installation fails for any reason, check the following:
|
||||||
|
|
||||||
* Does ".htconfig.php" exist? If not, edit htconfig.php and change the system settings. Rename to .htconfig.php
|
* Does ".htconfig.php" exist? If not, edit htconfig.php and change the system settings. Rename to .htconfig.php
|
||||||
|
|
|
@ -9,7 +9,7 @@ How do you do it?
|
||||||
|
|
||||||
The Directories
|
The Directories
|
||||||
---
|
---
|
||||||
Friendica has two different kinds of "addressbook":
|
Friendica has two different kinds of "address book":
|
||||||
The directory of the Friendica server you are registered on and the global directory that collects account information across all Friendica instances.
|
The directory of the Friendica server you are registered on and the global directory that collects account information across all Friendica instances.
|
||||||
|
|
||||||
The first thing you can do is look at the **Directory**.
|
The first thing you can do is look at the **Directory**.
|
||||||
|
|
|
@ -130,7 +130,7 @@ By default, any (valid) email address is allowed in registrations.
|
||||||
|
|
||||||
#### Allow Users to set remote_self
|
#### Allow Users to set remote_self
|
||||||
|
|
||||||
If you enable the `Allow Users to set remote_self` users can select Atom feeds from their contact list being their *remote self* in die advanced contact settings.
|
If you enable the `Allow Users to set remote_self` users can select Atom feeds from their contact list being their *remote self* in the advanced contact settings.
|
||||||
Which means that postings by the remote self are automatically reposted by Friendica in their names.
|
Which means that postings by the remote self are automatically reposted by Friendica in their names.
|
||||||
|
|
||||||
This feature can be used to let the user mirror e.g. blog postings into their Friendica postings.
|
This feature can be used to let the user mirror e.g. blog postings into their Friendica postings.
|
||||||
|
@ -212,7 +212,7 @@ To simplify this process there is a button at the top of the page to reload all
|
||||||
## Themes
|
## Themes
|
||||||
|
|
||||||
The Themes section of the admin panel works similar to the Plugins section but let you control the themes on your Friendica node.
|
The Themes section of the admin panel works similar to the Plugins section but let you control the themes on your Friendica node.
|
||||||
Each theme has a dedicated suppage showing the current status, some information about the theme and a screen-shot of the Friendica interface using the theme.
|
Each theme has a dedicated subpage showing the current status, some information about the theme and a screen-shot of the Friendica interface using the theme.
|
||||||
Should the theme offer special settings, admins can set a global default value here.
|
Should the theme offer special settings, admins can set a global default value here.
|
||||||
|
|
||||||
You can activate and deactivate themes on their dedicated sub-pages thus making them available for the users of the node.
|
You can activate and deactivate themes on their dedicated sub-pages thus making them available for the users of the node.
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
[[!meta title="And Finally..."]]
|
|
||||||
|
|
||||||
And that brings the Quick Start to an end.
|
|
||||||
|
|
||||||
Here are some more things to help get you started:
|
|
||||||
|
|
||||||
**Groups**
|
|
||||||
|
|
||||||
|
|
||||||
- <a href="http://helpers.pyxis.uberspace.de/profile/helpers">Friendica Support</a> - problems? This is the place to ask.
|
|
||||||
|
|
||||||
- <a href="https://letstalk.pyxis.uberspace.de/profile/letstalk">Let's Talk</a> a group for finding people and groups who share similar interests.
|
|
||||||
|
|
||||||
- <a href="http://newzot.hydra.uberspace.de/profile/newzot">Local Friendica</a> a page for local Friendica groups</a>
|
|
||||||
|
|
||||||
|
|
||||||
**Documentation**
|
|
||||||
|
|
||||||
- <a href="help/Connectors">Connecting to more networks</a>
|
|
||||||
- <a href="help">Help Index</a>
|
|
||||||
|
|
||||||
|
|
69
doc/api.md
69
doc/api.md
|
@ -3,7 +3,7 @@ Friendica API
|
||||||
|
|
||||||
* [Home](help)
|
* [Home](help)
|
||||||
|
|
||||||
The Friendica API aims to be compatible to the [GNU Social API](http://wiki.gnusocial.de/gnusocial:api) and the [Twitter API](https://dev.twitter.com/rest/public).
|
The Friendica API aims to be compatible with the [GNU Social API](http://wiki.gnusocial.de/gnusocial:api) and the [Twitter API](https://dev.twitter.com/rest/public).
|
||||||
|
|
||||||
Please refer to the linked documentation for further information.
|
Please refer to the linked documentation for further information.
|
||||||
|
|
||||||
|
@ -43,13 +43,13 @@ In this document, endpoints which requires auth are marked with "AUTH" after end
|
||||||
* network: network of the user
|
* network: network of the user
|
||||||
|
|
||||||
#### Errors
|
#### Errors
|
||||||
When an error occour in API call, an HTTP error code is returned, with an error message
|
When an error occurs in API call, an HTTP error code is returned, with an error message
|
||||||
Usually:
|
Usually:
|
||||||
- 400 Bad Request: if parameter are missing or items can't be found
|
- 400 Bad Request: if parameters are missing or items can't be found
|
||||||
- 403 Forbidden: if authenticated user is missing
|
- 403 Forbidden: if the authenticated user is missing
|
||||||
- 405 Method Not Allowed: if API was called with invalid method, eg. GET when API require POST
|
- 405 Method Not Allowed: if API was called with an invalid method, eg. GET when API require POST
|
||||||
- 501 Not Implemented: if requested API doesn't exists
|
- 501 Not Implemented: if the requested API doesn't exist
|
||||||
- 500 Internal Server Error: on other error contitions
|
- 500 Internal Server Error: on other error conditions
|
||||||
|
|
||||||
Error body is
|
Error body is
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ Unofficial Twitter command. It shows all direct answers (excluding the original
|
||||||
* id: id of the post
|
* id: id of the post
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ Unofficial Twitter command. It shows all direct answers (excluding the original
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* getText: Defines the format of the status field. Can be "html" or "plain"
|
* getText: Defines the format of the status field. Can be "html" or "plain"
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
@ -117,7 +117,7 @@ Unofficial Twitter command. It shows all direct answers (excluding the original
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* getText: Defines the format of the status field. Can be "html" or "plain"
|
* getText: Defines the format of the status field. Can be "html" or "plain"
|
||||||
* friendica_verbose: "true" enables different error returns (default: "false")
|
* friendica_verbose: "true" enables different error returns (default: "false")
|
||||||
|
@ -128,7 +128,7 @@ Shows all direct messages of a conversation
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* getText: Defines the format of the status field. Can be "html" or "plain"
|
* getText: Defines the format of the status field. Can be "html" or "plain"
|
||||||
* uri: URI of the conversation
|
* uri: URI of the conversation
|
||||||
|
@ -139,7 +139,7 @@ Shows all direct messages of a conversation
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* getText: Defines the format of the status field. Can be "html" or "plain"
|
* getText: Defines the format of the status field. Can be "html" or "plain"
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
@ -182,7 +182,7 @@ HTTP 400 BadRequest
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
|
||||||
|
@ -208,26 +208,26 @@ Set this values will result in an empty array.
|
||||||
---
|
---
|
||||||
### followers/ids (*; AUTH)
|
### followers/ids (*; AUTH)
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* stringify_ids: Should the id numbers be sent as text (true) or number (false)? (default: false)
|
* stringify_ids: Send id numbers as text (true) or integers (false)? (default: false)
|
||||||
|
|
||||||
#### Unsupported parameters
|
#### Unsupported parameters
|
||||||
* user_id
|
* user_id
|
||||||
* screen_name
|
* screen_name
|
||||||
* cursor
|
* cursor
|
||||||
|
|
||||||
Friendica doesn't allow showing followers of other users.
|
Friendica doesn't allow showing the followers of other users.
|
||||||
|
|
||||||
---
|
---
|
||||||
### friends/ids (*; AUTH)
|
### friends/ids (*; AUTH)
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* stringify_ids: Should the id numbers be sent as text (true) or number (false)? (default: false)
|
* stringify_ids: Send the id numbers as text (true) or integers (false)? (default: false)
|
||||||
|
|
||||||
#### Unsupported parameters
|
#### Unsupported parameters
|
||||||
* user_id
|
* user_id
|
||||||
* screen_name
|
* screen_name
|
||||||
* cursor
|
* cursor
|
||||||
|
|
||||||
Friendica doesn't allow showing friends of other users.
|
Friendica doesn't allow showing the friends of other users.
|
||||||
|
|
||||||
---
|
---
|
||||||
### help/test (*)
|
### help/test (*)
|
||||||
|
@ -283,7 +283,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* exclude_replies: don't show replies (default: false)
|
* exclude_replies: don't show replies (default: false)
|
||||||
* conversation_id: Shows all statuses of a given conversation.
|
* conversation_id: Shows all statuses of a given conversation.
|
||||||
|
@ -299,7 +299,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* exclude_replies: don't show replies (default: false)
|
* exclude_replies: don't show replies (default: false)
|
||||||
* conversation_id: Shows all statuses of a given conversation.
|
* conversation_id: Shows all statuses of a given conversation.
|
||||||
|
@ -315,7 +315,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* exclude_replies: don't show replies (default: false)
|
* exclude_replies: don't show replies (default: false)
|
||||||
* conversation_id: Shows all statuses of a given conversation.
|
* conversation_id: Shows all statuses of a given conversation.
|
||||||
|
@ -343,7 +343,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
#### Parameters
|
#### Parameters
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ Friendica doesn't allow showing friends of other users.
|
||||||
* screen_name: screen name (for technical reasons, this value is not unique!)
|
* screen_name: screen name (for technical reasons, this value is not unique!)
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* exclude_replies: don't show replies (default: false)
|
* exclude_replies: don't show replies (default: false)
|
||||||
* conversation_id: Shows all statuses of a given conversation.
|
* conversation_id: Shows all statuses of a given conversation.
|
||||||
|
@ -426,7 +426,7 @@ It shows all direct answers (excluding the original post) to a given id.
|
||||||
* id: id of the post
|
* id: id of the post
|
||||||
* count: Items per page (default: 20)
|
* count: Items per page (default: 20)
|
||||||
* page: page number
|
* page: page number
|
||||||
* since_id: minimal id
|
* since_id: minimum id
|
||||||
* max_id: maximum id
|
* max_id: maximum id
|
||||||
* include_entities: "true" shows entities for pictures and links (Default: false)
|
* include_entities: "true" shows entities for pictures and links (Default: false)
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ If the note is linked to an item, the item is returned, just like one of the "st
|
||||||
|
|
||||||
If the note is not linked to an item, a success status is returned:
|
If the note is not linked to an item, a success status is returned:
|
||||||
|
|
||||||
* "success" (json) | "<status>success</status>" (xml)
|
* "success" (json) | <status>success</status>;" (xml)
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -671,8 +671,8 @@ json
|
||||||
```
|
```
|
||||||
{
|
{
|
||||||
"id": "photo id"
|
"id": "photo id"
|
||||||
"created": "date(YYYY-MM-GG HH:MM:SS)",
|
"created": "date(YYYY-MM-DD HH:MM:SS)",
|
||||||
"edited": "date(YYYY-MM-GG HH:MM:SS)",
|
"edited": "date(YYYY-MM-DD HH:MM:SS)",
|
||||||
"title": "photo title",
|
"title": "photo title",
|
||||||
"desc": "photo description",
|
"desc": "photo description",
|
||||||
"album": "album name",
|
"album": "album name",
|
||||||
|
@ -695,8 +695,8 @@ xml
|
||||||
```
|
```
|
||||||
<photo>
|
<photo>
|
||||||
<id>photo id</id>
|
<id>photo id</id>
|
||||||
<created>date(YYYY-MM-GG HH:MM:SS)</created>
|
<created>date(YYYY-MM-DD HH:MM:SS)</created>
|
||||||
<edited>date(YYYY-MM-GG HH:MM:SS)</edited>
|
<edited>date(YYYY-MM-DD HH:MM:SS)</edited>
|
||||||
<title>photo title</title>
|
<title>photo title</title>
|
||||||
<desc>photo description</desc>
|
<desc>photo description</desc>
|
||||||
<album>album name</album>
|
<album>album name</album>
|
||||||
|
@ -793,13 +793,13 @@ On error:
|
||||||
* album: name of the album to be deleted (always necessary)
|
* album: name of the album to be deleted (always necessary)
|
||||||
* album_new (optional): can be used to change the album of a single photo if photo_id is specified
|
* album_new (optional): can be used to change the album of a single photo if photo_id is specified
|
||||||
* allow_cid/allow_gid/deny_cid/deny_gid (optional): on create: empty string or omitting = public photo, specify in format '```<x><y><z>```' for private photo;
|
* allow_cid/allow_gid/deny_cid/deny_gid (optional): on create: empty string or omitting = public photo, specify in format '```<x><y><z>```' for private photo;
|
||||||
on update: keys need to be present with empty values for setting a private photo now to public
|
on update: keys need to be present with empty values for changing a private photo to public
|
||||||
|
|
||||||
both calls point to one function for creating AND updating photos.
|
both calls point to one function for creating AND updating photos.
|
||||||
Saves data for the scales 0-2 to database (see above for scale description).
|
Saves data for the scales 0-2 to database (see above for scale description).
|
||||||
Call adds non-visible entries to items table to enable authenticated contacts to comment/like the photo.
|
Call adds non-visible entries to items table to enable authenticated contacts to comment/like the photo.
|
||||||
Client should pay attention to the fact that updated access rights are not transferred to the contacts. i.e. public photos remain publicly visible if they have been commented/liked before setting visibility back to a limited group.
|
Client should pay attention to the fact that updated access rights are not transferred to the contacts. i.e. public photos remain publicly visible if they have been commented/liked before setting visibility back to a limited group.
|
||||||
Currently it is best way to inform user that updating rights is not the best way, offer a solution to add photo as a new photo with the new rights.
|
Currently it is best to inform user that updating rights is not the right way to do this, and offer a solution to add photo as a new photo with the new rights instead.
|
||||||
|
|
||||||
#### Return values
|
#### Return values
|
||||||
|
|
||||||
|
@ -884,8 +884,8 @@ On success: Array of:
|
||||||
* profiles: array of the profile data
|
* profiles: array of the profile data
|
||||||
|
|
||||||
On error:
|
On error:
|
||||||
HTTP 403 Forbidden: when no authentication provided
|
HTTP 403 Forbidden: when no authentication was provided
|
||||||
HTTP 400 Bad Request: if given profile_id is not in db or not assigned to authenticated user
|
HTTP 400 Bad Request: if given profile_id is not in the database or is not assigned to the authenticated user
|
||||||
|
|
||||||
General description of profile data in API returns:
|
General description of profile data in API returns:
|
||||||
* profile_id
|
* profile_id
|
||||||
|
@ -913,7 +913,7 @@ The following API calls are implemented in GNU Social but not in Friendica: (inc
|
||||||
* blocks/create
|
* blocks/create
|
||||||
* blocks/destroy
|
* blocks/destroy
|
||||||
|
|
||||||
The following API calls from the Twitter API aren't implemented neither in Friendica nor in GNU Social:
|
The following API calls from the Twitter API are not implemented in either Friendica or GNU Social:
|
||||||
|
|
||||||
* statuses/mentions_timeline
|
* statuses/mentions_timeline
|
||||||
* statuses/retweets/:id
|
* statuses/retweets/:id
|
||||||
|
@ -990,7 +990,6 @@ The following API calls from the Twitter API aren't implemented neither in Frien
|
||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
### BASH / cURL
|
### BASH / cURL
|
||||||
Betamax has documentated some example API usage from a [bash script](https://en.wikipedia.org/wiki/Bash_(Unix_shell) employing [curl](https://en.wikipedia.org/wiki/CURL) (see [his posting](https://betamax65.de/display/betamax65/43539)).
|
|
||||||
|
|
||||||
/usr/bin/curl -u USER:PASS https://YOUR.FRIENDICA.TLD/api/statuses/update.xml -d source="some source id" -d status="the status you want to post"
|
/usr/bin/curl -u USER:PASS https://YOUR.FRIENDICA.TLD/api/statuses/update.xml -d source="some source id" -d status="the status you want to post"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
Table locks
|
Table locks
|
||||||
===========
|
===========
|
||||||
|
|
||||||
| Field | Description | Type | Null | Key | Default | Extra |
|
| Field | Description | Type | Null | Key | Default | Extra |
|
||||||
|---------|------------------|--------------|------|-----|---------------------|----------------|
|
|---------|------------------|------------------|------|-----|---------------------|----------------|
|
||||||
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
|
| id | sequential ID | int(11) | NO | PRI | NULL | auto_increment |
|
||||||
| name | | varchar(128) | NO | | | |
|
| name | | varchar(128) | NO | | | |
|
||||||
| locked | | tinyint(1) | NO | | 0 | |
|
| locked | | tinyint(1) | NO | | 0 | |
|
||||||
| created | | datetime | YES | | 0001-01-01 00:00:00 | |
|
| pid | Process ID | int(10) unsigned | NO | | 0 | |
|
||||||
|
|
||||||
Return to [database documentation](help/database)
|
Return to [database documentation](help/database)
|
||||||
|
|
|
@ -9,37 +9,37 @@ Account - Basics
|
||||||
Nicht alle Friendica-Knoten bieten die Möglichkeit zur Registrierung.
|
Nicht alle Friendica-Knoten bieten die Möglichkeit zur Registrierung.
|
||||||
Wenn die Registrierung möglich ist, wird ein "Registrieren"-Link unter dem Login-Feld auf der Startseite angezeigt, der zur Registrierungsseite führt.
|
Wenn die Registrierung möglich ist, wird ein "Registrieren"-Link unter dem Login-Feld auf der Startseite angezeigt, der zur Registrierungsseite führt.
|
||||||
Die Stärke unseres Netzwerks ist, dass die verschiedenen Knoten komplett kompatibel zueinander sind.
|
Die Stärke unseres Netzwerks ist, dass die verschiedenen Knoten komplett kompatibel zueinander sind.
|
||||||
Wenn der Knoten, den Du besuchst, keine Registrierung anbietet, oder wenn Du glaubst, dass Dir eine andere Seite möglicherweise besser gefällt, dann kannst Du hier eine <a href="http://dir.friendica.com/siteinfo">Liste von öffentlichen Servern (Knoten)</a> finden und den Knoten heraus suchen, der am Besten zu Deinen Anforderungen passt.
|
Wenn der Knoten, den Du besuchst, keine Registrierung anbietet, oder wenn Du glaubst, dass Dir eine andere Seite möglicherweise besser gefällt, dann kannst Du hier eine <a href="https://dir.friendica.social/servers">Liste von öffentlichen Servern (Knoten)</a> finden und den Knoten heraus suchen, der am Besten zu Deinen Anforderungen passt.
|
||||||
|
|
||||||
Wenn Du Deinen eigenen Server aufsetzen willst, kannst Du das ebenfalls machen.
|
Wenn Du Deinen eigenen Server aufsetzen willst, kannst Du das ebenfalls machen.
|
||||||
Besuche <a href="http://friendica.com/download">die Friendica-Webseite</a>, um den Code mit den Installationsanleitungen herunterzuladen.
|
Besuche <a href="http://friendi.ca">die Friendica-Webseite</a>, um den Code mit den Installationsanleitungen herunterzuladen.
|
||||||
Es ist ein einfacher Installationsprozess, den jeder mit ein wenig Erfahrungen im Webseiten-Hosting oder mit grundlegenden Linux-Erfahrungen einfach handhaben kann.
|
Es ist ein einfacher Installationsprozess, den jeder mit ein wenig Erfahrungen im Webseiten-Hosting oder mit grundlegenden Linux-Erfahrungen einfach handhaben kann.
|
||||||
|
|
||||||
|
|
||||||
*OpenID*
|
*OpenID*
|
||||||
|
|
||||||
Das erste Feld auf der Registrierungsseite ist für eine OpenID-Adresse.
|
Das erste Feld auf der Registrierungsseite ist für eine OpenID-Adresse.
|
||||||
Wenn Du keine OpenID-Adresse hast oder nicht wünschst, diese zu nutzen, dann lasse das Feld frei.
|
Wenn Du keine OpenID-Adresse hast oder nicht wünschst, diese zu nutzen, dann lasse das Feld frei.
|
||||||
Wenn Du einen OpenID-Account hast und diesen nutzen willst, gib die Adresse in das Feld ein und klicke auf "Registrieren".
|
Wenn Du einen OpenID-Account hast und diesen nutzen willst, gib die Adresse in das Feld ein und klicke auf "Registrieren".
|
||||||
Friendica wird versuchen, so viele Informationen wie möglich von Deinem OpenID-Provider zu übernehmen, um diese in Dein Profil auf dieser Seite einzutragen.
|
Friendica wird versuchen, so viele Informationen wie möglich von Deinem OpenID-Provider zu übernehmen, um diese in Dein Profil auf dieser Seite einzutragen.
|
||||||
|
|
||||||
|
|
||||||
*Dein vollständiger Name*
|
*Dein vollständiger Name*
|
||||||
|
|
||||||
Bitte trage Deinen vollständigen Namen **so ein, wie Du ihn im System anzeigen lassen willst**.
|
Bitte trage Deinen vollständigen Namen **so ein, wie Du ihn im System anzeigen lassen willst**.
|
||||||
Viele Leute nutzen ihren richtigen Namen hierfür, allerdings besteht für dich keine Pflicht, das auch so zu machen.
|
Viele Leute nutzen ihren richtigen Namen hierfür, allerdings besteht für dich keine Pflicht, das auch so zu machen.
|
||||||
|
|
||||||
|
|
||||||
*Email-Adresse*
|
*Email-Adresse*
|
||||||
|
|
||||||
Bitte trage eine richtige Email-Adresse ein.
|
Bitte trage eine richtige Email-Adresse ein.
|
||||||
Deine Email-Adresse wird **niemals** veröffentlicht.
|
Deine Email-Adresse wird **niemals** veröffentlicht.
|
||||||
Wir benötigen diese, um Dir Account-Informationen und die Login-Daten zu schicken.
|
Wir benötigen diese, um Dir Account-Informationen und die Login-Daten zu schicken.
|
||||||
Du erhältst zudem von Zeit zu Zeit Benachrichtigungen über eingegangene Nachrichten oder Punkte, die Deine Aufmerksamkeit benötigen.
|
Du erhältst zudem von Zeit zu Zeit Benachrichtigungen über eingegangene Nachrichten oder Punkte, die Deine Aufmerksamkeit benötigen.
|
||||||
Du hast aber auch die Möglichkeit, diese Nachrichten in Deinen Account-Einstellungen komplett abzuschalten.
|
Du hast aber auch die Möglichkeit, diese Nachrichten in Deinen Account-Einstellungen komplett abzuschalten.
|
||||||
|
|
||||||
Du musst nicht Deine Haupt-Email-Adresse sein, jedoch wird eine funktionierende Adresse benötigt.
|
Du musst nicht Deine Haupt-Email-Adresse sein, jedoch wird eine funktionierende Adresse benötigt.
|
||||||
Ohne dieses kannst Du weder Dein Initialpasswort erhalten, noch Dein Passwort zurücksetzen.
|
Ohne dieses kannst Du weder Dein Initialpasswort erhalten, noch Dein Passwort zurücksetzen.
|
||||||
Dies ist die einzige persönliche Information, die korrekt sein muss.
|
Dies ist die einzige persönliche Information, die korrekt sein muss.
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ Falls Du Schwierigkeiten beim Login hast, prüfe bitte, ob z. B. Deine Feststell
|
||||||
|
|
||||||
**Passwort ändern**
|
**Passwort ändern**
|
||||||
|
|
||||||
Besuche nach Deinem ersten Login bitte die Einstellungsseite und wechsle das Passwort in eines, dass Du Dir merken kannst.
|
Besuche nach Deinem ersten Login bitte die Einstellungsseite und wechsle das Passwort in eines, dass Du Dir merken kannst.
|
||||||
|
|
||||||
|
|
||||||
**Der Anfang**
|
**Der Anfang**
|
||||||
|
@ -95,7 +95,7 @@ Ein ['Tipp für neue Mitglieder'](newmember)-Link zeigt sich in den ersten beide
|
||||||
|
|
||||||
**Persönliche Daten exportieren**
|
**Persönliche Daten exportieren**
|
||||||
|
|
||||||
Du kannst eine Kopie Deiner persönlichen Daten in einer XML-Datei exportieren.
|
Du kannst eine Kopie Deiner persönlichen Daten in einer XML-Datei exportieren.
|
||||||
Gehe hierzu in Deinen Einstellungen auf "Persönliche Daten exportieren".
|
Gehe hierzu in Deinen Einstellungen auf "Persönliche Daten exportieren".
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,17 +61,17 @@ table.bbcodes > * > tr > th {
|
||||||
<td><span style="color: red;">rot</span></td>
|
<td><span style="color: red;">rot</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=http://www.friendica.com]Friendica[/url]</td>
|
<td>[url=http://friendi.ca]Friendica[/url]</td>
|
||||||
<td><a href="http://www.friendica.com" target="external-link">Friendica</a></td>
|
<td><a href="http://friendi.ca" target="external-link">Friendica</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[img]http://friendica.com/sites/default/files/friendika-32.png[/img]</td>
|
<td>[img]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]</td>
|
||||||
<td><img src="http://friendica.com/sites/default/files/friendika-32.png" alt="Immagine/foto"></td>
|
<td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" alt="Immagine/foto"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[img=64x32]http://friendica.com/sites/default/files/friendika-32.png[/img]<br>
|
<td>[img=64x32]https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg[/img]<br>
|
||||||
<br>Note: provided height is simply discarded.</td>
|
<br>Note: provided height is simply discarded.</td>
|
||||||
<td><img src="http://friendica.com/sites/default/files/friendika-32.png" style="width: 64px;"></td>
|
<td><img src="https://raw.githubusercontent.com/friendica/friendica/master/images/friendica-32.jpg" style="width: 64px;"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[size=xx-small]kleiner Text[/size]</td>
|
<td>[size=xx-small]kleiner Text[/size]</td>
|
||||||
|
@ -99,23 +99,23 @@ table.bbcodes > * > tr > th {
|
||||||
<th>Ergebnis</th>
|
<th>Ergebnis</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url]http://friendica.com[/url]</td>
|
<td>[url]http://friendi.ca[/url]</td>
|
||||||
<td><a href="http://friendica.com">http://friendica.com</a></td>
|
<td><a href="http://friendi.ca">http://friendi.ca</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=http://friendica.com]Friendica[/url]</td>
|
<td>[url=http://friendi.ca.com]Friendica[/url]</td>
|
||||||
<td><a href="http://friendica.com">Friendica</a></td>
|
<td><a href="http://friendi.ca.com">Friendica</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[bookmark]http://friendica.com[/bookmark]<br><br>
|
<td>[bookmark]http://friendi.ca[/bookmark]<br><br>
|
||||||
#^[url]http://friendica.com[/url]</td>
|
#^[url]http://friendi.ca[/url]</td>
|
||||||
<td><span class="oembed link"><h4>Friendica: <a href="http://friendica.com" rel="oembed"></a><a href="http://friendica.com" target="_blank">http://friendica.com</a></h4></span></td>
|
<td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">http://friendi.ca</a></h4></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[bookmark=http://friendica.com]Lesezeichen[/bookmark]<br><br>
|
<td>[bookmark=http://friendi.ca]Lesezeichen[/bookmark]<br><br>
|
||||||
#^[url=http://friendica.com]Lesezeichen[/url]<br><br>
|
#^[url=http://friendi.ca]Lesezeichen[/url]<br><br>
|
||||||
#[url=http://friendica.com]^[/url][url=http://friendica.com]Lesezeichen[/url]</td>
|
#[url=http://friendi.ca]^[/url][url=http://friendi.ca]Lesezeichen[/url]</td>
|
||||||
<td><span class="oembed link"><h4>Friendica: <a href="http://friendica.com" rel="oembed"></a><a href="http://friendica.com" target="_blank">Lesezeichen</a></h4></span></td>
|
<td><span class="oembed link"><h4>Friendica: <a href="http://friendi.ca" rel="oembed"></a><a href="http://friendi.ca" target="_blank">Lesezeichen</a></h4></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora Beitrag mit GUID[/url]</td>
|
<td>[url=/posts/f16d77b0630f0134740c0cc47a0ea02a]Diaspora Beitrag mit GUID[/url]</td>
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
... und zuletzt
|
|
||||||
===============
|
|
||||||
|
|
||||||
Und damit sind wir auch schon am Ende der Schnellstartanleitung.
|
|
||||||
|
|
||||||
Hier sind noch einige weitere Dinge, die Dir den Start vereinfachen können.
|
|
||||||
|
|
||||||
**Gruppen**
|
|
||||||
|
|
||||||
|
|
||||||
- <a href="http://helpers.pyxis.uberspace.de/profile/helpers">Friendica Support</a> - Probleme? Dann ist das der Platz, um zu fragen!
|
|
||||||
|
|
||||||
|
|
||||||
**Dokumentation**
|
|
||||||
|
|
||||||
- <a href="help/Connectors">Zu weiteren Netzwerken verbinden</a>
|
|
||||||
- <a href="help">Zur Startseite der Hilfe</a>
|
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
Neue Freunde finden
|
|
||||||
==============
|
|
||||||
|
|
||||||
* [Zur Startseite der Hilfe](help)
|
|
||||||
|
|
||||||
Hier siehst du die Kontaktvorschläge.
|
|
||||||
Wenn du dich mal verirrt hast, kannst du <a href="help/makenewfriends">diesen Link klicken</a> und wieder hierher kommen.
|
|
||||||
|
|
||||||
Diese Seite ist ein wenig wie die Kontaktvorschläge in Facebook.
|
|
||||||
Jeder auf dieser Liste hat zugestimmt, als Kontaktvorschlag zu erscheinen.
|
|
||||||
Das bedeutet, das sie Anfragen meist nicht ablehnen, da sie neue Leute kennenlernen wollen.
|
|
||||||
|
|
||||||
Siehst du jemanden, dessen Aussehen du magst?
|
|
||||||
Klicke auf den "Verbinden"-Button beim Foto.
|
|
||||||
Als nächstes kommst du zur Seite "Freundschafts-/Kontaktanfrage".
|
|
||||||
Fülle das Formular wie vorgegeben aus und trage optional eine kleine Notiz ein.
|
|
||||||
Nun musst du nur noch auf die Bestätigung warten.
|
|
||||||
Beachte dabei, dass es sich um reale Personen handelt und es somit etwas dauern kann.
|
|
||||||
Jetzt, nachdem du jemanden hinzugefügt hast, weißt du vielleicht nicht mehr, wie du zurückkommst.
|
|
||||||
Klicke einfach auf den Link oben auf dieser Seite und du kommst zurück zur Seite mit den Kontaktvorschlägen, um weitere Personen hinzuzufügen.
|
|
||||||
|
|
||||||
Du willst nicht einfach Personen hinzufügen, die du nicht kennst?
|
|
||||||
Kein Problem - an dieser Stelle kommen wir zu den <a href="help/groupsandpages">Gruppen und Seiten</a>.
|
|
||||||
|
|
||||||
<iframe src="suggest" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
Deine "Netzwerk"-Seite
|
|
||||||
==============
|
|
||||||
|
|
||||||
* [Zur Startseite der Hilfe](help)
|
|
||||||
|
|
||||||
Das ist dein "Netzwerk"-Tab.
|
|
||||||
Wenn du dich mal verirrt hast, kannst du <a href="help/network">diesen Link klicken</a>, um wieder hierher zu kommen.
|
|
||||||
|
|
||||||
Diese Seite ist ein wenig wie die News-Seite in Facebook oder der Stream in Diaspora.
|
|
||||||
Hier findest du alle Beiträge deiner Kontakte, Gruppen und Feeds, die du eingetragen hast.
|
|
||||||
Wenn du neu bist, siehst du hier noch nichts, falls du deinen Status im letzten Schritt noch nicht eingetragen hast.
|
|
||||||
Wenn du bereits ein paar Freunde eingetragen hast, findest du hier ihre Beiträge.
|
|
||||||
Hier kannst du Beiträge kommentieren, eintragen, dass du den Beitrag magst oder ablehnst oder die Profile durch einen Klick auf deren Namen anschauen und auf deren Seite ("Wall") Nachrichten schreiben.
|
|
||||||
|
|
||||||
Nun wollen wir diese Seite mit Inhalt füllen.
|
|
||||||
Der erste Schritt ist es, Leute <a href="help/makingnewfriends">zu deinem Account hinzuzufügen</a>.
|
|
||||||
|
|
||||||
<iframe src="network" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,15 @@ Depending on the theme you are using, there might be an additional link from the
|
||||||
|
|
||||||
## Event Overview
|
## Event Overview
|
||||||
|
|
||||||
The overview page shows the calendar of the current month, plus eventually some days in the beginning and the end.
|
The overview page shows the calendar of the current month, plus a few days days at the beginning and the end.
|
||||||
Listed are all events for this month you created, or your contacts have shared with you.
|
Listed are all events for this month, created by you, or shared with you by your contacts,
|
||||||
This includes birthday reminders for contacts who share their birthday with you.
|
This includes birthday reminders for contacts who share their birthday with you.
|
||||||
|
|
||||||
From the controls, you can switch between month/week/day view.
|
From the controls, you can switch between month/week/day view.
|
||||||
Flip through the view forwards and backwards.
|
Flip through the view forwards and backwards.
|
||||||
And return to *today*.
|
And return to *today*.
|
||||||
|
|
||||||
To create a new event, you can either follow the link "Create New Event" or make a double click on the desired box in the calendarium for when the event should take place.
|
To create a new event, you can either follow the link "Create New Event" or double click on the desired box in the calendar in which the event should take place.
|
||||||
|
|
||||||
With a click on an existing event a pop-up box will be opened which shows you the event.
|
With a click on an existing event a pop-up box will be opened which shows you the event.
|
||||||
From there you can edit the event or view the event at the source link, if you are the one who created the event.
|
From there you can edit the event or view the event at the source link, if you are the one who created the event.
|
||||||
|
@ -31,14 +31,14 @@ Fields marked with a *** have to be filled.
|
||||||
* **Event Finishes**: enter the finishing date/time for the event here
|
* **Event Finishes**: enter the finishing date/time for the event here
|
||||||
|
|
||||||
When you click in one of these fields a pop-up will be opened that allows you to pick the day and the time.
|
When you click in one of these fields a pop-up will be opened that allows you to pick the day and the time.
|
||||||
If you double clicked on the day box in the calendarium these fields will be pre-filled for you.
|
If you double clicked on the day box in the calendar these fields will be pre-filled for you.
|
||||||
The finishing date/time has to be after the beginning date/time of the event.
|
The finishing date/time has to be after the beginning date/time of the event.
|
||||||
But you don't have to specify it.
|
But you don't have to specify it.
|
||||||
If the event is open-end or the finishing date/time does not matter, just select the box below the two first fields.
|
If the event is open-ended or the finishing date/time does not matter, just select the box below the two first fields.
|
||||||
|
|
||||||
* **Adjust for viewer timezone**: If you check this box, the beginning and finisching times will automatically converted to the local time according to the timezone setting
|
* **Adjust for viewer timezone**: If you check this box, the beginning and finishing times will automatically converted to the local time according to the timezone setting
|
||||||
|
|
||||||
This might prevent too early birthday wishes, or the panic attac that you have forgotten the birthday from your buddy at the other end of the world.
|
This might prevent early birthday wishes, or the panic that you have forgotten the birthday from your buddy at the other side of the world.
|
||||||
And similar events.
|
And similar events.
|
||||||
|
|
||||||
* **Title**: a title for the event
|
* **Title**: a title for the event
|
||||||
|
@ -46,7 +46,7 @@ And similar events.
|
||||||
* **Location**: the location the event will took place
|
* **Location**: the location the event will took place
|
||||||
|
|
||||||
These three fields describe your events.
|
These three fields describe your events.
|
||||||
In the descirption and location field you can use BBCode to format the text.
|
In the description and location field you can use BBCode to format the text.
|
||||||
|
|
||||||
* **Share this event**: when this box is checked the ACL will be shown to let you select with whom you wish to share the event. This works just like the controls of any other posting.
|
* **Share this event**: when this box is checked the ACL will be shown to let you select with whom you wish to share the event. This works just like the controls of any other posting.
|
||||||
|
|
||||||
|
@ -59,13 +59,13 @@ When you publish an event, you can choose who shall receive it, as with a regula
|
||||||
The recipients will see the posting about the event in their network-stream.
|
The recipients will see the posting about the event in their network-stream.
|
||||||
Additionally it will be added to their calendar and thus be shown in their events overview page.
|
Additionally it will be added to their calendar and thus be shown in their events overview page.
|
||||||
|
|
||||||
Recipients of the event-posting can comment or dis-/like the event, as with a regular posting, but also announce that they will attend, not attend or may-be attend the event with a single click.
|
Recipients of the event-posting can comment or dis-/like the event, as with a regular posting, and also announce that they will attend, not attend or may-be attend the event with a single click.
|
||||||
|
|
||||||
### Addons
|
### Addons
|
||||||
|
|
||||||
#### OpenStreetMap
|
#### OpenStreetMap
|
||||||
|
|
||||||
If this addon is activated on you friendica node, the content of the location field will be mathced with the identification service of OSM when you submit the event.
|
If this addon is activated on you friendica node, the content of the location field will be matched with the identification service of OSM when you submit the event.
|
||||||
Should OSM find anything matching, a map for the location will be embedded automatically at the end of the events view.
|
Should OSM find anything matching, a map for the location will be embedded automatically at the end of the events view.
|
||||||
|
|
||||||
#### Calendar Export
|
#### Calendar Export
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
This is the global directory. If you get lost, you can <a href = "help/groupsandpages">click this link</a> to bring yourself back here.
|
|
||||||
|
|
||||||
On this page, you'll find a collection of groups, forums and celebrity pages. Groups are not real people. Connecting to them is similar to "liking" something on Facebook, or signing up for a new forum. You don't have to feel awkward about introducing yourself to a new person, because they're not people!
|
|
||||||
|
|
||||||
When you connect to a group, all messages to that group will start appearing in your network tab. You can comment on these posts, or post to the group yourself without ever having to add any of the groups members. This is a great way to make friends dynamically - you'll find people you like and add each other naturally instead of adding random strangers. Simply find a group you're interested in, and connect to it the same way you did with people in the last section. There are a lot of groups, and you're likely to get lost. Remember the link at the top of this page will bring you back here.
|
|
||||||
|
|
||||||
Once you've added some groups, <a href="help/andfinally">move on to the next section</a>.
|
|
||||||
|
|
||||||
<iframe src="http://dir.friendica.com/directory/forum" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
13
doc/guide.md
13
doc/guide.md
|
@ -1,13 +0,0 @@
|
||||||
First things first, let's make sure you're logged in to your account. If you're not already logged in, do so in the frame below.
|
|
||||||
|
|
||||||
Once you've logged in (or if you are already logged in), you'll now be looking at your profile page.
|
|
||||||
|
|
||||||
This is a bit like your Facebook wall. It's where all your status messgages are kept, and where your friends come to post on your wall. To write your status, simply click in the box that says "share". When you do this, the box will expand. You can see some formatting options at the top such as Bold, Italics and Underline, as well as ways to add links and pictures. At the bottom you'll find some more links. You can use these to upload pictures and files from your computer, share websites with a bit of preview text, or embed video and audio files from elsewhere on the web. You can also set your post location here.
|
|
||||||
|
|
||||||
Once you've finished writing your post, click on the padlock icon to select who can see it. If you do not use the padlock icon, your post will be public. This means it will appear to anybody who views your profile, and in the community tab if your site has it enabled, as well as in the network tab of any of your contacts.
|
|
||||||
|
|
||||||
Play around with this a bit, then when you're ready to move on, we'll take a look at the <a href="help/network">Network Tab</a>
|
|
||||||
|
|
||||||
<iframe src="login" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Especially don't do that with undocumented values.
|
||||||
The header of the section describes the category, the value is the parameter.
|
The header of the section describes the category, the value is the parameter.
|
||||||
Example: To set the directory value please add this line to your .htconfig.php:
|
Example: To set the directory value please add this line to your .htconfig.php:
|
||||||
|
|
||||||
$a->config['system']['directory'] = 'http://dir.friendi.ca';
|
$a->config['system']['directory'] = 'http://dir.friendica.social';
|
||||||
|
|
||||||
## jabber ##
|
## jabber ##
|
||||||
* **debug** (Boolean) - Enable debug level for the jabber account synchronisation.
|
* **debug** (Boolean) - Enable debug level for the jabber account synchronisation.
|
||||||
|
@ -25,7 +25,7 @@ Example: To set the directory value please add this line to your .htconfig.php:
|
||||||
* **allowed_link_protocols** (Array) - Allowed protocols in links URLs, add at your own risk. http is always allowed.
|
* **allowed_link_protocols** (Array) - Allowed protocols in links URLs, add at your own risk. http is always allowed.
|
||||||
* **birthday_input_format** - Default value is "ymd".
|
* **birthday_input_format** - Default value is "ymd".
|
||||||
* **block_local_dir** (Boolean) - Blocks the access to the directory of the local users.
|
* **block_local_dir** (Boolean) - Blocks the access to the directory of the local users.
|
||||||
* **auth_cookie_lifetime** (Integer) - Number of days that should pass without any activity from a before before the users who choosed "Remember me" when logging in from that browser is considered logged out. Defaults to 7.
|
* **auth_cookie_lifetime** (Integer) - Number of days that should pass without any activity before a user who chose "Remember me" when logging in is considered logged out. Defaults to 7.
|
||||||
* **curl_range_bytes** - Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".
|
* **curl_range_bytes** - Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".
|
||||||
* **db_log** - Name of a logfile to log slow database queries
|
* **db_log** - Name of a logfile to log slow database queries
|
||||||
* **db_loglimit** - If a database call lasts longer than this value it is logged
|
* **db_loglimit** - If a database call lasts longer than this value it is logged
|
||||||
|
@ -35,24 +35,27 @@ Example: To set the directory value please add this line to your .htconfig.php:
|
||||||
* **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index)
|
* **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index)
|
||||||
* **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched
|
* **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched
|
||||||
* **dbclean** (Boolean) - Enable the automatic database cleanup process
|
* **dbclean** (Boolean) - Enable the automatic database cleanup process
|
||||||
|
* **dbclean-expire-days** (Integer) - Days after which remote items will be deleted. Own items, and marked or filed items are kept.
|
||||||
* **default_service_class** -
|
* **default_service_class** -
|
||||||
* **delivery_batch_count** - Number of deliveries per process. Default value is 1. (Disabled when using the worker)
|
* **delivery_batch_count** - Number of deliveries per process. Default value is 1. (Disabled when using the worker)
|
||||||
* **diaspora_test** (Boolean) - For development only. Disables the message transfer.
|
* **diaspora_test** (Boolean) - For development only. Disables the message transfer.
|
||||||
* **directory** - The path to global directory. If not set then "http://dir.friendi.ca" is used.
|
* **directory** - The path to global directory. If not set then "http://dir.friendica.social" is used.
|
||||||
* **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
* **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
||||||
* **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
|
* **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
|
||||||
|
* **dlogfile - location of the developer log file
|
||||||
* **event_input_format** - Default value is "ymd".
|
* **event_input_format** - Default value is "ymd".
|
||||||
* **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
|
* **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
|
||||||
* **ignore_cache** (Boolean) - For development only. Disables the item cache.
|
* **ignore_cache** (Boolean) - For development only. Disables the item cache.
|
||||||
* **like_no_comment** (Boolean) - Don't update the "commented" value of an item when it is liked.
|
* **like_no_comment** (Boolean) - Don't update the "commented" value of an item when it is liked.
|
||||||
* **local_block** (Boolean) - Used in conjunction with "block_public".
|
* **local_block** (Boolean) - Used in conjunction with "block_public".
|
||||||
* **local_search** (Boolean) - Blocks the search for not logged in users to prevent crawlers from blocking your system.
|
* **local_search** (Boolean) - Blocks search for users who are not logged in to prevent crawlers from blocking your system.
|
||||||
* **max_connections** - The poller process isn't started when the maximum level of the possible database connections are used. When the system can't detect the maximum numbers of connection then this value can be used.
|
* **max_connections** - The maximum number of database connections which can be in use before the poller process is deferred to it's next interval. When the system can't detect the maximum numbers of connection then this value can be used.
|
||||||
* **max_connections_level** - The maximum level of connections that are allowed to let the poller start. It is a percentage value. Default value is 75.
|
* **max_connections_level** - The maximum level of connections that are allowed to let the poller start. It is a percentage value. Default value is 75.
|
||||||
* **max_contact_queue** - Default value is 500.
|
* **max_contact_queue** - Default value is 500.
|
||||||
* **max_batch_queue** - Default value is 1000.
|
* **max_batch_queue** - Default value is 1000.
|
||||||
* **max_processes_backend** - Maximum number of concurrent database processes for background tasks. Default value is 5.
|
* **max_processes_backend** - Maximum number of concurrent database processes for background tasks. Default value is 5.
|
||||||
* **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20.
|
* **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20.
|
||||||
|
* **min_poll_interval** - minimal distance in minutes between two polls for a contact. Default is 1. Reasonable values are between 1 and 59.
|
||||||
* **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated.
|
* **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated.
|
||||||
* **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'.
|
* **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'.
|
||||||
* **memcache_port** - Portnumber of the memcache daemon. Default is 11211.
|
* **memcache_port** - Portnumber of the memcache daemon. Default is 11211.
|
||||||
|
@ -114,3 +117,10 @@ If more then one account should be able to access the admin panel, seperate the
|
||||||
If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
|
If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
|
||||||
|
|
||||||
$a->config['admin_name'] = "Marvin";
|
$a->config['admin_name'] = "Marvin";
|
||||||
|
|
||||||
|
## Database Settings
|
||||||
|
|
||||||
|
The configuration variables db_host, db_user, db_pass and db_data are holding your credentials for the database connection.
|
||||||
|
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the db_host variable.
|
||||||
|
|
||||||
|
$db_host = 'your.mysqlhost.com:123456';
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
This is your Suggested Friends page. If you get lost, you can <a href="help/makenewfriends">click this link</a> to bring yourself back here.
|
|
||||||
|
|
||||||
This is a bit like the Friend Suggestions page of Facebook. Everybody on this list has agreed that they may be suggested as a friend. This means they're unlikely to refuse an introduction you send, and they want to meet new people too!
|
|
||||||
|
|
||||||
See somebody you like the look of? Click the connect button beneath their photograph. This will bring you to the introductions page. Fill in the form as instructed, and add a small note (optional). Now, wait a bit and they'll accept your request - note that these are real people, and it might take a while. Now you've added one, you're probably lost. Click the link at the top of this page to go back to the suggested friends list and add some more.
|
|
||||||
|
|
||||||
Feel uncomfortable adding people you don't know? Don't worry - that's where <a href="help/groupsandpages">Groups and Pages</a> come in!
|
|
||||||
|
|
||||||
<iframe src="suggest" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
This is your Network Tab.
|
|
||||||
If you get lost, you can <a href="help/network">click this link</a> to bring yourself back here.
|
|
||||||
|
|
||||||
This is a bit like the Newsfeed at Facebook or the Stream at Diaspora.
|
|
||||||
It's where all the posts from your contacts, groups, and feeds will appear.
|
|
||||||
If you're new, you won't see anything in this page, unless you posted your status in the last step.
|
|
||||||
If you've already added a few friends, you'll be able to see their posts.
|
|
||||||
Here, you can comment, like, or dislike posts, or click on somebody's name to visit their profile page where you can write on their wall.
|
|
||||||
|
|
||||||
Now we need to fill it up, the first step, is to <a href="help/makingnewfriends"> make some new friends</a>.
|
|
||||||
|
|
||||||
<iframe src="network" width="950" height="600"></iframe>
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ Form Templates
|
||||||
|
|
||||||
To guarantee a consistent look and feel for input forms, i.e. in the settings sections, there are templates for the basic form fields. They are initialized with an array of data, depending on the tyle of the field.
|
To guarantee a consistent look and feel for input forms, i.e. in the settings sections, there are templates for the basic form fields. They are initialized with an array of data, depending on the tyle of the field.
|
||||||
|
|
||||||
All of these take an array for holding the values, i.e. for an one line text input field, which is required and should be used to type email addesses use something along
|
All of these take an array for holding the values, eg,. for a one line text input field, which is required and should be used to type email addesses use something along the lines of:
|
||||||
|
|
||||||
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'),
|
'$adminmail' => array('adminmail', t('Site administrator email address'), $adminmail, t('Your account email address must match this in order to use the web admin panel.'), 'required', '', 'email'),
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* [Home](help)
|
* [Home](help)
|
||||||
|
|
||||||
To change the look of friendica you have to touch the themes.
|
To change the look of friendica you have to touch the themes.
|
||||||
The current default theme is [duepunto zero](https://github.com/friendica/friendica/tree/master/view/theme/duepuntozero) but there are numerous others.
|
The current default theme is [Vier](https://github.com/friendica/friendica/tree/master/view/theme/vier) but there are numerous others.
|
||||||
Have a look at [friendica-themes.com](http://friendica-themes.com) for an overview of the existing themes.
|
Have a look at [friendica-themes.com](http://friendica-themes.com) for an overview of the existing themes.
|
||||||
In case none of them suits your needs, there are several ways to change a theme.
|
In case none of them suits your needs, there are several ways to change a theme.
|
||||||
If you need help theming, there is a forum @[ftdevs@friendica.eu](https://friendica.eu/profile/ftdevs) where you can ask theme specific questions and present your themes.
|
If you need help theming, there is a forum @[ftdevs@friendica.eu](https://friendica.eu/profile/ftdevs) where you can ask theme specific questions and present your themes.
|
||||||
|
@ -69,7 +69,7 @@ Many themes are more *theme families* then only one theme.
|
||||||
*duepunto zero* and *vier* allow easily to add new theme variation.
|
*duepunto zero* and *vier* allow easily to add new theme variation.
|
||||||
We will go through the process of creating a new variation for *duepunto zero*.
|
We will go through the process of creating a new variation for *duepunto zero*.
|
||||||
The same (well almost, some names change) procedure applies to the *vier* theme.
|
The same (well almost, some names change) procedure applies to the *vier* theme.
|
||||||
And similar steps are needed for *quattro* but this theme is using [lessc](http://lesscss.org/#docs) to maintaine the CSS files..
|
And similar steps are needed for *quattro* but this theme is using [lessc](http://lesscss.org/#docs) to maintain the CSS files..
|
||||||
|
|
||||||
In
|
In
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ If you think your color variation could be benifical for other friendica users a
|
||||||
|
|
||||||
### Inheritation
|
### Inheritation
|
||||||
|
|
||||||
Say, you like the duepuntozero but you want to have the content of the outer columns left and right exchanged.
|
Say, you like the duepuntozero but you want to have the content of the outer columns left and right exchanged.
|
||||||
That would be not a color variation as shown above.
|
That would be not a color variation as shown above.
|
||||||
Instead we will create a new theme, duepuntozero_lr, inherit the properties of duepuntozero and make small changes to the underlying php files.
|
Instead we will create a new theme, duepuntozero_lr, inherit the properties of duepuntozero and make small changes to the underlying php files.
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ That done, you can select it in the settings like any other activated theme.
|
||||||
## Creating a Theme from Scratch
|
## Creating a Theme from Scratch
|
||||||
|
|
||||||
Keep patient.
|
Keep patient.
|
||||||
Basically what you have to do is identifying which template you have to change so it looks more like what you want.
|
Basically what you have to do is identify which template you have to change so it looks more like what you want.
|
||||||
Adopt the CSS of the theme accordingly.
|
Adopt the CSS of the theme accordingly.
|
||||||
And iterate the process until you have the theme the way you want it.
|
And iterate the process until you have the theme the way you want it.
|
||||||
|
|
||||||
|
@ -243,11 +243,11 @@ For example, have a look at the theme.php of the *quattro* theme:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
You see the definition of the themes name, it's version and the initial author of the theme.
|
You see the definition of the themes name, it's version and the initial author of the theme.
|
||||||
These three information should be listed.
|
These three pieces of information should be listed.
|
||||||
If the original author is not anymore working on the theme, but a maintainer has taken over, the maintainer should be listed as well.
|
If the original author is no longer working on the theme, but a maintainer has taken over, the maintainer should be listed as well.
|
||||||
The information from the theme header will be displayed in the admin panelö.
|
The information from the theme header will be displayed in the admin panelö.
|
||||||
|
|
||||||
Next crucial part of the theme.php file is a definition of an init function.
|
The next crucial part of the theme.php file is a definition of an init function.
|
||||||
The name of the function is <theme-name>_init.
|
The name of the function is <theme-name>_init.
|
||||||
So in the case of quattro it is
|
So in the case of quattro it is
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ So in the case of quattro it is
|
||||||
set_template_engine($a, 'smarty3');
|
set_template_engine($a, 'smarty3');
|
||||||
}
|
}
|
||||||
|
|
||||||
Here we have set the basic theme information, in this case they are empthy.
|
Here we have set the basic theme information, in this case they are empty.
|
||||||
But the array needs to be set.
|
But the array needs to be set.
|
||||||
And we have set the template engine that should be used by friendica for this theme.
|
And we have set the template engine that should be used by friendica for this theme.
|
||||||
At the moment you should use the *smarty3* engine.
|
At the moment you should use the *smarty3* engine.
|
||||||
|
@ -289,4 +289,4 @@ The default file is in
|
||||||
/view/default.php
|
/view/default.php
|
||||||
|
|
||||||
if you want to change it, say adding a 4th column for banners of your favourite FLOSS projects, place a new default.php file in your theme directory.
|
if you want to change it, say adding a 4th column for banners of your favourite FLOSS projects, place a new default.php file in your theme directory.
|
||||||
As with the theme.php file, you can use the properties of the $a variable with holds the friendica application to decide what content is displayed.
|
As with the theme.php file, you can use the properties of the $a variable with holds the friendica application to decide what content is displayed.
|
||||||
|
|
|
@ -6,7 +6,7 @@ Friendica translations
|
||||||
Translation Process
|
Translation Process
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
The strings used in the UI of Friendica is translated at [Transifex] [1] and then included in the git repository at github.
|
The strings used in the UI of Friendica are translated at [Transifex] [1] and then included in the git repository at github.
|
||||||
If you want to help with translation for any language, be it correcting terms or translating friendica to a currently not supported language, please register an account at transifex.com and contact the friendica translation team there.
|
If you want to help with translation for any language, be it correcting terms or translating friendica to a currently not supported language, please register an account at transifex.com and contact the friendica translation team there.
|
||||||
|
|
||||||
Translating friendica is simple.
|
Translating friendica is simple.
|
||||||
|
@ -22,7 +22,7 @@ If you want to help translating, please concentrate on the core messages.po file
|
||||||
We will only include translations with a sufficient translated messages.po file.
|
We will only include translations with a sufficient translated messages.po file.
|
||||||
Translations of addons will only be included, when the core file is included as well.
|
Translations of addons will only be included, when the core file is included as well.
|
||||||
|
|
||||||
If you want to get your work into the source tree yourself, feel free to do so and contact us with and question that arises.
|
If you want to get your work into the source tree yourself, feel free to do so and contact us with and questions that arise.
|
||||||
The process is simple and friendica ships with all the tools necessary.
|
The process is simple and friendica ships with all the tools necessary.
|
||||||
|
|
||||||
The location of the translated files in the source tree is
|
The location of the translated files in the source tree is
|
||||||
|
|
|
@ -262,33 +262,33 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
|
||||||
$profile = $default;
|
$profile = $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($profile["photo"] == "") AND isset($default["photo"])) {
|
if (($profile["photo"] == "") && isset($default["photo"])) {
|
||||||
$profile["photo"] = $default["photo"];
|
$profile["photo"] = $default["photo"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($profile["name"] == "") AND isset($default["name"])) {
|
if (($profile["name"] == "") && isset($default["name"])) {
|
||||||
$profile["name"] = $default["name"];
|
$profile["name"] = $default["name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($profile["network"] == "") AND isset($default["network"])) {
|
if (($profile["network"] == "") && isset($default["network"])) {
|
||||||
$profile["network"] = $default["network"];
|
$profile["network"] = $default["network"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($profile["thumb"] == "") AND isset($profile["photo"])) {
|
if (($profile["thumb"] == "") && isset($profile["photo"])) {
|
||||||
$profile["thumb"] = $profile["photo"];
|
$profile["thumb"] = $profile["photo"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($profile["micro"] == "") AND isset($profile["thumb"])) {
|
if (($profile["micro"] == "") && isset($profile["thumb"])) {
|
||||||
$profile["micro"] = $profile["thumb"];
|
$profile["micro"] = $profile["thumb"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND
|
if ((($profile["addr"] == "") || ($profile["name"] == "")) && ($profile["gid"] != 0) &&
|
||||||
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
||||||
proc_run(PRIORITY_LOW, "include/update_gcontact.php", $profile["gid"]);
|
proc_run(PRIORITY_LOW, "include/update_gcontact.php", $profile["gid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show contact details of Diaspora contacts only if connected
|
// Show contact details of Diaspora contacts only if connected
|
||||||
if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) {
|
if (($profile["cid"] == 0) && ($profile["network"] == NETWORK_DIASPORA)) {
|
||||||
$profile["location"] = "";
|
$profile["location"] = "";
|
||||||
$profile["about"] = "";
|
$profile["about"] = "";
|
||||||
$profile["gender"] = "";
|
$profile["gender"] = "";
|
||||||
|
@ -559,7 +559,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
// Update the contact every 7 days
|
// Update the contact every 7 days
|
||||||
$update_photo = ($contacts[0]['avatar-date'] < datetime_convert('','','now -7 days'));
|
$update_photo = ($contacts[0]['avatar-date'] < datetime_convert('','','now -7 days'));
|
||||||
|
|
||||||
if (!$update_photo OR $no_update) {
|
if (!$update_photo || $no_update) {
|
||||||
return $contact_id;
|
return $contact_id;
|
||||||
}
|
}
|
||||||
} elseif ($uid != 0) {
|
} elseif ($uid != 0) {
|
||||||
|
@ -636,7 +636,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($contacts) > 1 AND $uid == 0 AND $contact_id != 0 AND $url != "") {
|
if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $url != "") {
|
||||||
q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
|
q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
|
||||||
dbesc(normalise_link($url)),
|
dbesc(normalise_link($url)),
|
||||||
intval($contact_id));
|
intval($contact_id));
|
||||||
|
@ -654,9 +654,9 @@ function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only update if there had something been changed
|
// Only update if there had something been changed
|
||||||
if ($data["addr"] != $contacts[0]["addr"] OR
|
if ($data["addr"] != $contacts[0]["addr"] ||
|
||||||
$data["alias"] != $contacts[0]["alias"] OR
|
$data["alias"] != $contacts[0]["alias"] ||
|
||||||
$data["name"] != $contacts[0]["name"] OR
|
$data["name"] != $contacts[0]["name"] ||
|
||||||
$data["nick"] != $contacts[0]["nick"]) {
|
$data["nick"] != $contacts[0]["nick"]) {
|
||||||
q("UPDATE `contact` SET `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
|
q("UPDATE `contact` SET `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
|
||||||
`name-date` = '%s', `uri-date` = '%s' WHERE `id` = %d",
|
`name-date` = '%s', `uri-date` = '%s' WHERE `id` = %d",
|
||||||
|
@ -769,7 +769,7 @@ function formatted_location($profile) {
|
||||||
if($profile['locality'])
|
if($profile['locality'])
|
||||||
$location .= $profile['locality'];
|
$location .= $profile['locality'];
|
||||||
|
|
||||||
if($profile['region'] AND ($profile['locality'] != $profile['region'])) {
|
if($profile['region'] && ($profile['locality'] != $profile['region'])) {
|
||||||
if($location)
|
if($location)
|
||||||
$location .= ', ';
|
$location .= ', ';
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,12 @@
|
||||||
* @brief Methods for read and write notifications from/to database
|
* @brief Methods for read and write notifications from/to database
|
||||||
* or for formatting notifications
|
* or for formatting notifications
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once 'include/html2plain.php';
|
require_once 'include/html2plain.php';
|
||||||
require_once 'include/probe.php';
|
require_once 'include/probe.php';
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
require_once 'include/bbcode.php';
|
require_once 'include/bbcode.php';
|
||||||
|
require_once 'include/Contact.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Methods for read and write notifications from/to database
|
* @brief Methods for read and write notifications from/to database
|
||||||
|
@ -510,7 +512,7 @@ class NotificationsManager {
|
||||||
$myurl = substr($myurl,strpos($myurl,'://')+3);
|
$myurl = substr($myurl,strpos($myurl,'://')+3);
|
||||||
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
|
$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
|
||||||
$diasp_url = str_replace('/profile/','/u/',$myurl);
|
$diasp_url = str_replace('/profile/','/u/',$myurl);
|
||||||
$sql_extra = sprintf(" AND ( `item`.`author-link` regexp '%s' or `item`.`tag` regexp '%s' or `item`.`tag` regexp '%s' ) ",
|
$sql_extra = sprintf(" AND ( `item`.`author-link` regexp '%s' OR `item`.`tag` regexp '%s' OR `item`.`tag` regexp '%s' ) ",
|
||||||
dbesc($myurl . '$'),
|
dbesc($myurl . '$'),
|
||||||
dbesc($myurl . '\\]'),
|
dbesc($myurl . '\\]'),
|
||||||
dbesc($diasp_url . '\\]')
|
dbesc($diasp_url . '\\]')
|
||||||
|
@ -720,10 +722,12 @@ class NotificationsManager {
|
||||||
$sql_extra = " AND `ignore` = 0 ";
|
$sql_extra = " AND `ignore` = 0 ";
|
||||||
|
|
||||||
/// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
|
/// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
|
||||||
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
|
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*,
|
||||||
|
`fcontact`.`name` AS `fname`, `fcontact`.`url` AS `furl`,
|
||||||
|
`fcontact`.`photo` AS `fphoto`, `fcontact`.`request` AS `frequest`,
|
||||||
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
|
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
|
||||||
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
|
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
|
||||||
`gcontact`.`network` AS `gnetwork`
|
`gcontact`.`network` AS `gnetwork`, `gcontact`.`addr` AS `gaddr`
|
||||||
FROM `intro`
|
FROM `intro`
|
||||||
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
|
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
|
||||||
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
|
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
|
||||||
|
@ -786,11 +790,7 @@ class NotificationsManager {
|
||||||
// Normal connection requests
|
// Normal connection requests
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Probe the contact url to get missing data
|
$it = $this->getMissingIntroData($it);
|
||||||
$ret = probe_url($it["url"]);
|
|
||||||
|
|
||||||
if ($it['gnetwork'] == "")
|
|
||||||
$it['gnetwork'] = $ret["network"];
|
|
||||||
|
|
||||||
// Don't show these data until you are connected. Diaspora is doing the same.
|
// Don't show these data until you are connected. Diaspora is doing the same.
|
||||||
if($it['gnetwork'] === NETWORK_DIASPORA) {
|
if($it['gnetwork'] === NETWORK_DIASPORA) {
|
||||||
|
@ -815,7 +815,7 @@ class NotificationsManager {
|
||||||
'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
|
'post_newfriend' => (intval(get_pconfig(local_user(),'system','post_newfriend')) ? '1' : 0),
|
||||||
'url' => $it['url'],
|
'url' => $it['url'],
|
||||||
'zrl' => zrl($it['url']),
|
'zrl' => zrl($it['url']),
|
||||||
'addr' => $ret['addr'],
|
'addr' => $it['gaddr'],
|
||||||
'network' => $it['gnetwork'],
|
'network' => $it['gnetwork'],
|
||||||
'knowyou' => $it['knowyou'],
|
'knowyou' => $it['knowyou'],
|
||||||
'note' => $it['note'],
|
'note' => $it['note'],
|
||||||
|
@ -827,4 +827,38 @@ class NotificationsManager {
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check for missing contact data and try to fetch the data from
|
||||||
|
* from other sources
|
||||||
|
*
|
||||||
|
* @param array $arr The input array with the intro data
|
||||||
|
*
|
||||||
|
* @return array The array with the intro data
|
||||||
|
*/
|
||||||
|
private function getMissingIntroData($arr) {
|
||||||
|
// If the network and the addr isn't available from the gcontact
|
||||||
|
// table entry, take the one of the contact table entry
|
||||||
|
if ($arr['gnetwork'] == "") {
|
||||||
|
$arr['gnetwork'] = $arr['network'];
|
||||||
|
}
|
||||||
|
if ($arr['gaddr'] == "") {
|
||||||
|
$arr['gaddr'] = $arr['addr'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the network and addr is still not available
|
||||||
|
// get the missing data data from other sources
|
||||||
|
if ($arr['gnetwork'] == "" || $arr['gaddr'] == "") {
|
||||||
|
$ret = get_contact_details_by_url($arr['url']);
|
||||||
|
|
||||||
|
if ($arr['gnetwork'] == "" && $ret['network'] != "") {
|
||||||
|
$arr['gnetwork'] = $ret['network'];
|
||||||
|
}
|
||||||
|
if ($arr['gaddr'] == "" && $ret['addr'] != "") {
|
||||||
|
$arr['gaddr'] = $ret['addr'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -778,21 +778,29 @@ function guess_image_type($filename, $fromcurl=false) {
|
||||||
* @return array Returns array of the different avatar sizes
|
* @return array Returns array of the different avatar sizes
|
||||||
*/
|
*/
|
||||||
function update_contact_avatar($avatar, $uid, $cid, $force = false) {
|
function update_contact_avatar($avatar, $uid, $cid, $force = false) {
|
||||||
|
$r = q("SELECT `avatar`, `photo`, `thumb`, `micro`, `nurl` FROM `contact` WHERE `id` = %d LIMIT 1", intval($cid));
|
||||||
$r = q("SELECT `avatar`, `photo`, `thumb`, `micro` FROM `contact` WHERE `id` = %d LIMIT 1", intval($cid));
|
|
||||||
if (!dbm::is_result($r)) {
|
if (!dbm::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$data = array($r[0]["photo"], $r[0]["thumb"], $r[0]["micro"]);
|
$data = array($r[0]["photo"], $r[0]["thumb"], $r[0]["micro"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($r[0]["avatar"] != $avatar) OR $force) {
|
if (($r[0]["avatar"] != $avatar) || $force) {
|
||||||
$photos = import_profile_photo($avatar, $uid, $cid, true);
|
$photos = import_profile_photo($avatar, $uid, $cid, true);
|
||||||
|
|
||||||
if ($photos) {
|
if ($photos) {
|
||||||
q("UPDATE `contact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `avatar` = '%s', `photo` = '%s', `thumb` = '%s', `micro` = '%s', `avatar-date` = '%s' WHERE `id` = %d",
|
||||||
dbesc($avatar), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]),
|
dbesc($avatar), dbesc($photos[0]), dbesc($photos[1]), dbesc($photos[2]),
|
||||||
dbesc(datetime_convert()), intval($cid));
|
dbesc(datetime_convert()), intval($cid));
|
||||||
|
|
||||||
|
// Update the public contact (contact id = 0)
|
||||||
|
if ($uid != 0) {
|
||||||
|
$pcontact = dba::select('contact', array('id'), array('nurl' => $r[0]['nurl']), array('limit' => 1));
|
||||||
|
if (dbm::is_result($pcontact)) {
|
||||||
|
update_contact_avatar($avatar, 0, $pcontact['id'], $force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $photos;
|
return $photos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -817,7 +825,7 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
|
||||||
$filename = basename($photo);
|
$filename = basename($photo);
|
||||||
$img_str = fetch_url($photo, true);
|
$img_str = fetch_url($photo, true);
|
||||||
|
|
||||||
if ($quit_on_error AND ($img_str == "")) {
|
if ($quit_on_error && ($img_str == "")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,14 +855,35 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$photo = App::get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt();
|
$suffix = '?ts='.time();
|
||||||
$thumb = App::get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt();
|
|
||||||
$micro = App::get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt();
|
$photo = App::get_baseurl() . '/photo/' . $hash . '-4.' . $img->getExt() . $suffix;
|
||||||
|
$thumb = App::get_baseurl() . '/photo/' . $hash . '-5.' . $img->getExt() . $suffix;
|
||||||
|
$micro = App::get_baseurl() . '/photo/' . $hash . '-6.' . $img->getExt() . $suffix;
|
||||||
|
|
||||||
|
// Remove the cached photo
|
||||||
|
$a = get_app();
|
||||||
|
$basepath = $a->get_basepath();
|
||||||
|
|
||||||
|
if (is_dir($basepath."/photo")) {
|
||||||
|
$filename = $basepath.'/photo/'.$hash.'-4.'.$img->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
$filename = $basepath.'/photo/'.$hash.'-5.'.$img->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
$filename = $basepath.'/photo/'.$hash.'-6.'.$img->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($photo_failure AND $quit_on_error) {
|
if ($photo_failure && $quit_on_error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +902,7 @@ function get_photo_info($url) {
|
||||||
|
|
||||||
$data = Cache::get($url);
|
$data = Cache::get($url);
|
||||||
|
|
||||||
if (is_null($data) OR !$data OR !is_array($data)) {
|
if (is_null($data) || !$data || !is_array($data)) {
|
||||||
$img_str = fetch_url($url, true, $redirects, 4);
|
$img_str = fetch_url($url, true, $redirects, 4);
|
||||||
$filesize = strlen($img_str);
|
$filesize = strlen($img_str);
|
||||||
|
|
||||||
|
@ -967,7 +996,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
|
||||||
/// $default_cid = $r[0]['id'];
|
/// $default_cid = $r[0]['id'];
|
||||||
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
|
|
||||||
if ((strlen($imagedata) == 0) AND ($url == "")) {
|
if ((strlen($imagedata) == 0) && ($url == "")) {
|
||||||
logger("No image data and no url provided", LOGGER_DEBUG);
|
logger("No image data and no url provided", LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
} elseif (strlen($imagedata) == 0) {
|
} elseif (strlen($imagedata) == 0) {
|
||||||
|
@ -1073,7 +1102,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 160 AND $height > 160) {
|
if ($width > 160 && $height > 160) {
|
||||||
$x = 0;
|
$x = 0;
|
||||||
$y = 0;
|
$y = 0;
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
||||||
|
|
||||||
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
|
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
|
||||||
|
|
||||||
if ($privmail AND $preselected) {
|
if ($privmail && $preselected) {
|
||||||
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
|
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
|
||||||
$hidepreselected = ' style="display: none;"';
|
$hidepreselected = ' style="display: none;"';
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,7 +261,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
|
||||||
|
|
||||||
$o .= "</select>\r\n";
|
$o .= "</select>\r\n";
|
||||||
|
|
||||||
if ($privmail AND $preselected) {
|
if ($privmail && $preselected) {
|
||||||
$o .= implode(", ", $receiverlist);
|
$o .= implode(", ", $receiverlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +388,9 @@ function populate_acl($user = null, $show_jotnets = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function construct_acl_data(App $a, $user) {
|
function construct_acl_data(App $a, $user) {
|
||||||
|
// This function is now deactivated. It seems as if the generated data isn't used anywhere.
|
||||||
|
/// @todo Remove this function and all function calls before releasing Friendica 3.5.3
|
||||||
|
return;
|
||||||
|
|
||||||
// Get group and contact information for html ACL selector
|
// Get group and contact information for html ACL selector
|
||||||
$acl_data = acl_lookup($a, 'html');
|
$acl_data = acl_lookup($a, 'html');
|
||||||
|
|
|
@ -456,10 +456,13 @@ $called_api = null;
|
||||||
* Contact url or False if contact id is unknown
|
* Contact url or False if contact id is unknown
|
||||||
*/
|
*/
|
||||||
function api_unique_id_to_url($id) {
|
function api_unique_id_to_url($id) {
|
||||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = 0 AND `id` = %d LIMIT 1",
|
$r = dba::select('contact', array('url'), array('uid' => 0, 'id' => $id), array('limit' => 1));
|
||||||
intval($id));
|
|
||||||
|
|
||||||
return (dbm::is_result($r) && $r[0]["url"]);
|
if (dbm::is_result($r)) {
|
||||||
|
return $r["url"];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -480,7 +483,7 @@ $called_api = null;
|
||||||
logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
|
logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
// Searching for contact URL
|
// Searching for contact URL
|
||||||
if (!is_null($contact_id) AND (intval($contact_id) == 0)) {
|
if (!is_null($contact_id) && (intval($contact_id) == 0)) {
|
||||||
$user = dbesc(normalise_link($contact_id));
|
$user = dbesc(normalise_link($contact_id));
|
||||||
$url = $user;
|
$url = $user;
|
||||||
$extra_query = "AND `contact`.`nurl` = '%s' ";
|
$extra_query = "AND `contact`.`nurl` = '%s' ";
|
||||||
|
@ -490,7 +493,7 @@ $called_api = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Searching for contact id with uid = 0
|
// Searching for contact id with uid = 0
|
||||||
if (!is_null($contact_id) AND (intval($contact_id) != 0)) {
|
if (!is_null($contact_id) && (intval($contact_id) != 0)) {
|
||||||
$user = dbesc(api_unique_id_to_url($contact_id));
|
$user = dbesc(api_unique_id_to_url($contact_id));
|
||||||
|
|
||||||
if ($user == "") {
|
if ($user == "") {
|
||||||
|
@ -535,7 +538,7 @@ $called_api = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($user) AND ($a->argc > (count($called_api) - 1)) AND (count($called_api) > 0)) {
|
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) {
|
||||||
$argid = count($called_api);
|
$argid = count($called_api);
|
||||||
list($user, $null) = explode(".", $a->argv[$argid]);
|
list($user, $null) = explode(".", $a->argv[$argid]);
|
||||||
if (is_numeric($user)) {
|
if (is_numeric($user)) {
|
||||||
|
@ -597,7 +600,7 @@ $called_api = null;
|
||||||
$network_name = network_to_name($r[0]['network'], $r[0]['url']);
|
$network_name = network_to_name($r[0]['network'], $r[0]['url']);
|
||||||
|
|
||||||
// If no nick where given, extract it from the address
|
// If no nick where given, extract it from the address
|
||||||
if (($r[0]['nick'] == "") OR ($r[0]['name'] == $r[0]['nick'])) {
|
if (($r[0]['nick'] == "") || ($r[0]['name'] == $r[0]['nick'])) {
|
||||||
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
$r[0]['nick'] = api_get_nick($r[0]["url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +716,7 @@ $called_api = null;
|
||||||
$starred = 0;
|
$starred = 0;
|
||||||
|
|
||||||
// Add a nick if it isn't present there
|
// Add a nick if it isn't present there
|
||||||
if (($uinfo[0]['nick'] == "") OR ($uinfo[0]['name'] == $uinfo[0]['nick'])) {
|
if (($uinfo[0]['nick'] == "") || ($uinfo[0]['name'] == $uinfo[0]['nick'])) {
|
||||||
$uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
|
$uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +749,7 @@ $called_api = null;
|
||||||
'contributors_enabled' => false,
|
'contributors_enabled' => false,
|
||||||
'is_translator' => false,
|
'is_translator' => false,
|
||||||
'is_translation_enabled' => false,
|
'is_translation_enabled' => false,
|
||||||
'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) OR ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
|
'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) || ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
|
||||||
'follow_request_sent' => false,
|
'follow_request_sent' => false,
|
||||||
'statusnet_blocking' => false,
|
'statusnet_blocking' => false,
|
||||||
'notifications' => false,
|
'notifications' => false,
|
||||||
|
@ -774,10 +777,10 @@ $called_api = null;
|
||||||
|
|
||||||
$status_user = api_get_user($a, $item["author-link"]);
|
$status_user = api_get_user($a, $item["author-link"]);
|
||||||
|
|
||||||
$status_user["protected"] = (($item["allow_cid"] != "") OR
|
$status_user["protected"] = (($item["allow_cid"] != "") ||
|
||||||
($item["allow_gid"] != "") OR
|
($item["allow_gid"] != "") ||
|
||||||
($item["deny_cid"] != "") OR
|
($item["deny_cid"] != "") ||
|
||||||
($item["deny_gid"] != "") OR
|
($item["deny_gid"] != "") ||
|
||||||
$item["private"]);
|
$item["private"]);
|
||||||
|
|
||||||
if ($item['thr-parent'] == $item['uri']) {
|
if ($item['thr-parent'] == $item['uri']) {
|
||||||
|
@ -1302,9 +1305,9 @@ $called_api = null;
|
||||||
$status_info["entities"] = $converted["entities"];
|
$status_info["entities"] = $converted["entities"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($lastwall['item_network'] != "") AND ($status["source"] == 'web')) {
|
if (($lastwall['item_network'] != "") && ($status["source"] == 'web')) {
|
||||||
$status_info["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
|
$status_info["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
|
||||||
} elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $status_info["source"])) {
|
} elseif (($lastwall['item_network'] != "") && (network_to_name($lastwall['item_network'], $user_info['url']) != $status_info["source"])) {
|
||||||
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network'], $user_info['url']).')');
|
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network'], $user_info['url']).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,11 +1393,11 @@ $called_api = null;
|
||||||
$user_info["status"]["entities"] = $converted["entities"];
|
$user_info["status"]["entities"] = $converted["entities"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($lastwall['item_network'] != "") AND ($user_info["status"]["source"] == 'web')) {
|
if (($lastwall['item_network'] != "") && ($user_info["status"]["source"] == 'web')) {
|
||||||
$user_info["status"]["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
|
$user_info["status"]["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $user_info["status"]["source"])) {
|
if (($lastwall['item_network'] != "") && (network_to_name($lastwall['item_network'], $user_info['url']) != $user_info["status"]["source"])) {
|
||||||
$user_info["status"]["source"] = trim($user_info["status"]["source"] . ' (' . network_to_name($lastwall['item_network'], $user_info['url']) . ')');
|
$user_info["status"]["source"] = trim($user_info["status"]["source"] . ' (' . network_to_name($lastwall['item_network'], $user_info['url']) . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2175,7 +2178,7 @@ $called_api = null;
|
||||||
`contact`.`id` AS `cid`
|
`contact`.`id` AS `cid`
|
||||||
FROM `item`, `contact`
|
FROM `item`, `contact`
|
||||||
WHERE `item`.`uid` = %d
|
WHERE `item`.`uid` = %d
|
||||||
AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
AND `item`.`visible` = 1 AND `item`.`moderated` = 0 AND `item`.`deleted` = 0
|
||||||
AND `item`.`starred` = 1
|
AND `item`.`starred` = 1
|
||||||
AND `contact`.`id` = `item`.`contact-id`
|
AND `contact`.`id` = `item`.`contact-id`
|
||||||
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||||
|
@ -2260,13 +2263,13 @@ $called_api = null;
|
||||||
|
|
||||||
$statustitle = trim($item['title']);
|
$statustitle = trim($item['title']);
|
||||||
|
|
||||||
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false)) {
|
if (($statustitle != '') && (strpos($statusbody, $statustitle) !== false)) {
|
||||||
$statustext = trim($statusbody);
|
$statustext = trim($statusbody);
|
||||||
} else {
|
} else {
|
||||||
$statustext = trim($statustitle."\n\n".$statusbody);
|
$statustext = trim($statustitle."\n\n".$statusbody);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item["network"] == NETWORK_FEED) and (strlen($statustext)> 1000)) {
|
if (($item["network"] == NETWORK_FEED) && (strlen($statustext)> 1000)) {
|
||||||
$statustext = substr($statustext, 0, 1000)."... \n".$item["plink"];
|
$statustext = substr($statustext, 0, 1000)."... \n".$item["plink"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2286,6 +2289,11 @@ $called_api = null;
|
||||||
$statushtml = "<h4>" . bbcode($item['title']) . "</h4>\n" . $statushtml;
|
$statushtml = "<h4>" . bbcode($item['title']) . "</h4>\n" . $statushtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// feeds without body should contain the link
|
||||||
|
if (($item['network'] == NETWORK_FEED) && (strlen($item['body']) == 0)) {
|
||||||
|
$statushtml .= bbcode($item['plink']);
|
||||||
|
}
|
||||||
|
|
||||||
$entities = api_get_entitities($statustext, $body);
|
$entities = api_get_entitities($statustext, $body);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
@ -2394,8 +2402,8 @@ $called_api = null;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
//foreach ($urls[1] AS $id=>$url) {
|
//foreach ($urls[1] AS $id=>$url) {
|
||||||
foreach ($ordered_urls AS $url) {
|
foreach ($ordered_urls AS $url) {
|
||||||
if ((substr($url["title"], 0, 7) != "http://") AND (substr($url["title"], 0, 8) != "https://") AND
|
if ((substr($url["title"], 0, 7) != "http://") && (substr($url["title"], 0, 8) != "https://") &&
|
||||||
!strpos($url["title"], "http://") AND !strpos($url["title"], "https://"))
|
!strpos($url["title"], "http://") && !strpos($url["title"], "https://"))
|
||||||
$display_url = $url["title"];
|
$display_url = $url["title"];
|
||||||
else {
|
else {
|
||||||
$display_url = str_replace(array("http://www.", "https://www."), array("", ""), $url["url"]);
|
$display_url = str_replace(array("http://www.", "https://www."), array("", ""), $url["url"]);
|
||||||
|
@ -2447,7 +2455,7 @@ $called_api = null;
|
||||||
$scale = scale_image($image[0], $image[1], 150);
|
$scale = scale_image($image[0], $image[1], 150);
|
||||||
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
|
|
||||||
if (($image[0] > 150) OR ($image[1] > 150)) {
|
if (($image[0] > 150) || ($image[1] > 150)) {
|
||||||
$scale = scale_image($image[0], $image[1], 340);
|
$scale = scale_image($image[0], $image[1], 340);
|
||||||
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
}
|
}
|
||||||
|
@ -2455,7 +2463,7 @@ $called_api = null;
|
||||||
$scale = scale_image($image[0], $image[1], 600);
|
$scale = scale_image($image[0], $image[1], 600);
|
||||||
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
|
|
||||||
if (($image[0] > 600) OR ($image[1] > 600)) {
|
if (($image[0] > 600) || ($image[1] > 600)) {
|
||||||
$scale = scale_image($image[0], $image[1], 1024);
|
$scale = scale_image($image[0], $image[1], 1024);
|
||||||
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
}
|
}
|
||||||
|
@ -2660,7 +2668,7 @@ $called_api = null;
|
||||||
list($status_user, $owner_user) = api_item_get_user($a, $item);
|
list($status_user, $owner_user) = api_item_get_user($a, $item);
|
||||||
|
|
||||||
// Look if the posts are matching if they should be filtered by user id
|
// Look if the posts are matching if they should be filtered by user id
|
||||||
if ($filter_user AND ($status_user["id"] != $user_info["id"])) {
|
if ($filter_user && ($status_user["id"] != $user_info["id"])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2704,9 +2712,9 @@ $called_api = null;
|
||||||
$status["entities"] = $converted["entities"];
|
$status["entities"] = $converted["entities"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item['item_network'] != "") AND ($status["source"] == 'web')) {
|
if (($item['item_network'] != "") && ($status["source"] == 'web')) {
|
||||||
$status["source"] = network_to_name($item['item_network'], $user_info['url']);
|
$status["source"] = network_to_name($item['item_network'], $user_info['url']);
|
||||||
} elseif (($item['item_network'] != "") AND (network_to_name($item['item_network'], $user_info['url']) != $status["source"])) {
|
} elseif (($item['item_network'] != "") && (network_to_name($item['item_network'], $user_info['url']) != $status["source"])) {
|
||||||
$status["source"] = trim($status["source"].' ('.network_to_name($item['item_network'], $user_info['url']).')');
|
$status["source"] = trim($status["source"].' ('.network_to_name($item['item_network'], $user_info['url']).')');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2715,7 +2723,7 @@ $called_api = null;
|
||||||
// It doesn't work reliable with the link if its a feed
|
// It doesn't work reliable with the link if its a feed
|
||||||
//$IsRetweet = ($item['owner-link'] != $item['author-link']);
|
//$IsRetweet = ($item['owner-link'] != $item['author-link']);
|
||||||
//if ($IsRetweet)
|
//if ($IsRetweet)
|
||||||
// $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
|
// $IsRetweet = (($item['owner-name'] != $item['author-name']) || ($item['owner-avatar'] != $item['author-avatar']));
|
||||||
|
|
||||||
|
|
||||||
if ($item["id"] == $item["parent"]) {
|
if ($item["id"] == $item["parent"]) {
|
||||||
|
@ -3014,7 +3022,7 @@ $called_api = null;
|
||||||
|
|
||||||
if (api_user() === false) throw new ForbiddenException();
|
if (api_user() === false) throw new ForbiddenException();
|
||||||
|
|
||||||
if (!x($_POST, "text") OR (!x($_POST,"screen_name") AND !x($_POST,"user_id"))) return;
|
if (!x($_POST, "text") || (!x($_POST,"screen_name") && !x($_POST,"user_id"))) return;
|
||||||
|
|
||||||
$sender = api_get_user($a);
|
$sender = api_get_user($a);
|
||||||
|
|
||||||
|
@ -3027,8 +3035,9 @@ $called_api = null;
|
||||||
api_best_nickname($r);
|
api_best_nickname($r);
|
||||||
|
|
||||||
$recipient = api_get_user($a, $r[0]['nurl']);
|
$recipient = api_get_user($a, $r[0]['nurl']);
|
||||||
} else
|
} else {
|
||||||
$recipient = api_get_user($a, $_POST['user_id']);
|
$recipient = api_get_user($a, $_POST['user_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$replyto = '';
|
$replyto = '';
|
||||||
$sub = '';
|
$sub = '';
|
||||||
|
@ -3740,8 +3749,7 @@ $called_api = null;
|
||||||
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
proc_run(PRIORITY_LOW, "include/directory.php", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'include/profile_update.php';
|
proc_run(PRIORITY_LOW, 'include/profile_update.php', api_user());
|
||||||
profile_change();
|
|
||||||
|
|
||||||
// output for client
|
// output for client
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
@ -3974,7 +3982,7 @@ $called_api = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare_photo_data($type, $scale, $photo_id) {
|
function prepare_photo_data($type, $scale, $photo_id) {
|
||||||
$scale_sql = ($scale === false ? "" : sprintf("and scale=%d", intval($scale)));
|
$scale_sql = ($scale === false ? "" : sprintf("AND scale=%d", intval($scale)));
|
||||||
$data_sql = ($scale === false ? "" : "data, ");
|
$data_sql = ($scale === false ? "" : "data, ");
|
||||||
|
|
||||||
// added allow_cid, allow_gid, deny_cid, deny_gid to output as string like stored in database
|
// added allow_cid, allow_gid, deny_cid, deny_gid to output as string like stored in database
|
||||||
|
@ -4326,7 +4334,7 @@ $called_api = null;
|
||||||
$in_reply_to['user_id_str'] = NULL;
|
$in_reply_to['user_id_str'] = NULL;
|
||||||
$in_reply_to['screen_name'] = NULL;
|
$in_reply_to['screen_name'] = NULL;
|
||||||
|
|
||||||
if (($item['thr-parent'] != $item['uri']) AND (intval($item['parent']) != intval($item['id']))) {
|
if (($item['thr-parent'] != $item['uri']) && (intval($item['parent']) != intval($item['id']))) {
|
||||||
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
|
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
|
||||||
intval($item['uid']),
|
intval($item['uid']),
|
||||||
dbesc($item['thr-parent']));
|
dbesc($item['thr-parent']));
|
||||||
|
@ -4407,7 +4415,7 @@ $called_api = null;
|
||||||
if (isset($data["text"]))
|
if (isset($data["text"]))
|
||||||
$body = $data["text"];
|
$body = $data["text"];
|
||||||
|
|
||||||
if (($body == "") AND (isset($data["title"])))
|
if (($body == "") && (isset($data["title"])))
|
||||||
$body = $data["title"];
|
$body = $data["title"];
|
||||||
|
|
||||||
if (isset($data["url"]))
|
if (isset($data["url"]))
|
||||||
|
|
|
@ -29,7 +29,7 @@ if (isset($_COOKIE["Friendica"])) {
|
||||||
new_cookie($authcookiedays*24*60*60, $r[0]);
|
new_cookie($authcookiedays*24*60*60, $r[0]);
|
||||||
|
|
||||||
// Do the authentification if not done by now
|
// Do the authentification if not done by now
|
||||||
if (!isset($_SESSION) OR !isset($_SESSION['authenticated'])) {
|
if (!isset($_SESSION) || !isset($_SESSION['authenticated'])) {
|
||||||
authenticate_success($r[0]);
|
authenticate_success($r[0]);
|
||||||
|
|
||||||
if (get_config('system','paranoia'))
|
if (get_config('system','paranoia'))
|
||||||
|
|
|
@ -89,7 +89,7 @@ class exAuth {
|
||||||
|
|
||||||
// Open the logfile if the logfile name is defined
|
// Open the logfile if the logfile name is defined
|
||||||
if ($this->sLogFile != '')
|
if ($this->sLogFile != '')
|
||||||
$this->rLogFile = fopen($this->sLogFile, "a") or die("Error opening log file: ". $this->sLogFile);
|
$this->rLogFile = fopen($this->sLogFile, "a") || die("Error opening log file: ". $this->sLogFile);
|
||||||
|
|
||||||
$this->writeLog("[exAuth] start");
|
$this->writeLog("[exAuth] start");
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,14 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
||||||
$data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
|
$data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) {
|
if (((strpos($data["text"], "[img=") !== false) || (strpos($data["text"], "[img]") !== false)) && ($data["image"] != "")) {
|
||||||
$data["preview"] = $data["image"];
|
$data["preview"] = $data["image"];
|
||||||
$data["image"] = "";
|
$data["image"] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($simplehtml == 7) {
|
if ($simplehtml == 7) {
|
||||||
$text = style_url_for_mastodon($data["url"]);
|
$text = style_url_for_mastodon($data["url"]);
|
||||||
} elseif (($simplehtml != 4) AND ($simplehtml != 0)) {
|
} elseif (($simplehtml != 4) && ($simplehtml != 0)) {
|
||||||
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
|
||||||
} else {
|
} else {
|
||||||
$text = sprintf('<span class="type-%s">', $data["type"]);
|
$text = sprintf('<span class="type-%s">', $data["type"]);
|
||||||
|
@ -71,13 +71,13 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
|
||||||
if (strstr(strtolower($oembed), "<iframe ")) {
|
if (strstr(strtolower($oembed), "<iframe ")) {
|
||||||
$text = $oembed;
|
$text = $oembed;
|
||||||
} else {
|
} else {
|
||||||
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img ")) {
|
if (($data["image"] != "") && !strstr(strtolower($oembed), "<img ")) {
|
||||||
$text .= 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"]);
|
$text .= 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"]);
|
||||||
} elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img ")) {
|
} elseif (($data["preview"] != "") && !strstr(strtolower($oembed), "<img ")) {
|
||||||
$text .= 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"]);
|
$text .= 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"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != "")) {
|
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
|
||||||
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
|
||||||
} else {
|
} else {
|
||||||
$text .= $oembed;
|
$text .= $oembed;
|
||||||
|
@ -103,25 +103,25 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
|
||||||
|
|
||||||
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
|
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
|
||||||
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
|
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
|
||||||
if ($plaintext OR (($title != "") AND strstr($text, $title))) {
|
if ($plaintext || (($title != "") && strstr($text, $title))) {
|
||||||
$data["title"] = $data["url"];
|
$data["title"] = $data["url"];
|
||||||
} elseif (($text != "") AND strstr($title, $text)) {
|
} elseif (($text != "") && strstr($title, $text)) {
|
||||||
$data["text"] = $data["title"];
|
$data["text"] = $data["title"];
|
||||||
$data["title"] = $data["url"];
|
$data["title"] = $data["url"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == "")) {
|
if (($data["text"] == "") && ($data["title"] != "") && ($data["url"] == "")) {
|
||||||
return $data["title"] . $data["after"];
|
return $data["title"] . $data["after"];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the link already is included in the post, don't add it again
|
// If the link already is included in the post, don't add it again
|
||||||
if (($data["url"] != "") AND strpos($data["text"], $data["url"])) {
|
if (($data["url"] != "") && strpos($data["text"], $data["url"])) {
|
||||||
return $data["text"] . $data["after"];
|
return $data["text"] . $data["after"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = $data["text"];
|
$text = $data["text"];
|
||||||
|
|
||||||
if (($data["url"] != "") AND ($data["title"] != "")) {
|
if (($data["url"] != "") && ($data["title"] != "")) {
|
||||||
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
|
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
|
||||||
} elseif (($data["url"] != "")) {
|
} elseif (($data["url"] != "")) {
|
||||||
$text .= "\n" . $data["url"];
|
$text .= "\n" . $data["url"];
|
||||||
|
@ -147,7 +147,7 @@ function cleancss($input) {
|
||||||
for ($i = 0; $i < strlen($input); $i++) {
|
for ($i = 0; $i < strlen($input); $i++) {
|
||||||
$char = substr($input, $i, 1);
|
$char = substr($input, $i, 1);
|
||||||
|
|
||||||
if (($char >= "a") and ($char <= "z")) {
|
if (($char >= "a") && ($char <= "z")) {
|
||||||
$cleaned .= $char;
|
$cleaned .= $char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ function cleancss($input) {
|
||||||
function bb_style_url($match) {
|
function bb_style_url($match) {
|
||||||
$url = $match[1];
|
$url = $match[1];
|
||||||
|
|
||||||
if (isset($match[2]) AND ($match[1] != $match[2])) {
|
if (isset($match[2]) && ($match[1] != $match[2])) {
|
||||||
return $match[0];
|
return $match[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,20 +485,20 @@ function bb_ShareAttributes($share, $simplehtml) {
|
||||||
|
|
||||||
$data = get_contact_details_by_url($profile);
|
$data = get_contact_details_by_url($profile);
|
||||||
|
|
||||||
if (isset($data["name"]) AND ($data["name"] != "") AND isset($data["addr"]) AND ($data["addr"] != ""))
|
if (isset($data["name"]) && ($data["name"] != "") && isset($data["addr"]) && ($data["addr"] != ""))
|
||||||
$userid_compact = $data["name"]." (".$data["addr"].")";
|
$userid_compact = $data["name"]." (".$data["addr"].")";
|
||||||
else
|
else
|
||||||
$userid_compact = GetProfileUsername($profile,$author, true);
|
$userid_compact = GetProfileUsername($profile,$author, true);
|
||||||
|
|
||||||
if (isset($data["addr"]) AND ($data["addr"] != ""))
|
if (isset($data["addr"]) && ($data["addr"] != ""))
|
||||||
$userid = $data["addr"];
|
$userid = $data["addr"];
|
||||||
else
|
else
|
||||||
$userid = GetProfileUsername($profile,$author, false);
|
$userid = GetProfileUsername($profile,$author, false);
|
||||||
|
|
||||||
if (isset($data["name"]) AND ($data["name"] != ""))
|
if (isset($data["name"]) && ($data["name"] != ""))
|
||||||
$author = $data["name"];
|
$author = $data["name"];
|
||||||
|
|
||||||
if (isset($data["micro"]) AND ($data["micro"] != ""))
|
if (isset($data["micro"]) && ($data["micro"] != ""))
|
||||||
$avatar = $data["micro"];
|
$avatar = $data["micro"];
|
||||||
|
|
||||||
$preshare = trim($share[1]);
|
$preshare = trim($share[1]);
|
||||||
|
@ -744,7 +744,7 @@ function bb_RemovePictureLinks($match) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function bb_expand_links($match) {
|
function bb_expand_links($match) {
|
||||||
if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3])) {
|
if (($match[3] == "") || ($match[2] == $match[3]) || stristr($match[2], $match[3])) {
|
||||||
return ($match[1] . "[url]" . $match[2] . "[/url]");
|
return ($match[1] . "[url]" . $match[2] . "[/url]");
|
||||||
} else {
|
} else {
|
||||||
return ($match[1] . $match[3] . " [url]" . $match[2] . "[/url]");
|
return ($match[1] . $match[3] . " [url]" . $match[2] . "[/url]");
|
||||||
|
@ -930,7 +930,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
$MAILSearchString = $URLSearchString;
|
$MAILSearchString = $URLSearchString;
|
||||||
|
|
||||||
// Remove all hashtag addresses
|
// Remove all hashtag addresses
|
||||||
if ((!$tryoembed OR $simplehtml) AND !in_array($simplehtml, array(3, 7))) {
|
if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, array(3, 7))) {
|
||||||
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
|
||||||
} elseif ($simplehtml == 3) {
|
} elseif ($simplehtml == 3) {
|
||||||
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||||
|
@ -1126,7 +1126,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
// Check for [spoiler] text
|
// Check for [spoiler] text
|
||||||
// handle nested quotes
|
// handle nested quotes
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) {
|
while ((strpos($Text, "[/spoiler]") !== false) && (strpos($Text, "[spoiler]") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $Text);
|
$Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1136,7 +1136,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
|
|
||||||
// handle nested quotes
|
// handle nested quotes
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20)) {
|
while ((strpos($Text, "[/spoiler]")!== false) && (strpos($Text, "[spoiler=") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism",
|
$Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism",
|
||||||
"<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>",
|
"<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>",
|
||||||
$Text);
|
$Text);
|
||||||
|
@ -1148,7 +1148,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
// Check for [quote] text
|
// Check for [quote] text
|
||||||
// handle nested quotes
|
// handle nested quotes
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/quote]") !== false) and (strpos($Text, "[quote]") !== false) and (++$endlessloop < 20)) {
|
while ((strpos($Text, "[/quote]") !== false) && (strpos($Text, "[quote]") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism", "$QuoteLayout", $Text);
|
$Text = preg_replace("/\[quote\](.*?)\[\/quote\]/ism", "$QuoteLayout", $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,7 +1158,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
|
|
||||||
// handle nested quotes
|
// handle nested quotes
|
||||||
$endlessloop = 0;
|
$endlessloop = 0;
|
||||||
while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20)) {
|
while ((strpos($Text, "[/quote]")!== false) && (strpos($Text, "[quote=") !== false) && (++$endlessloop < 20)) {
|
||||||
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
|
$Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism",
|
||||||
"<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
|
"<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>",
|
||||||
$Text);
|
$Text);
|
||||||
|
@ -1319,7 +1319,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
|
||||||
// Clean up the HTML by loading and saving the HTML with the DOM.
|
// Clean up the HTML by loading and saving the HTML with the DOM.
|
||||||
// Bad structured html can break a whole page.
|
// Bad structured html can break a whole page.
|
||||||
// For performance reasons do it only with ativated item cache or at export.
|
// For performance reasons do it only with ativated item cache or at export.
|
||||||
if (!$tryoembed OR (get_itemcachepath() != "")) {
|
if (!$tryoembed || (get_itemcachepath() != "")) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->preserveWhiteSpace = false;
|
$doc->preserveWhiteSpace = false;
|
||||||
|
|
||||||
|
|
|
@ -172,35 +172,35 @@ class Cache {
|
||||||
set_config("system", "cache_cleared_day", time());
|
set_config("system", "cache_cleared_day", time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($max_level <= CACHE_HOUR) AND (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
|
if (($max_level <= CACHE_HOUR) && (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR));
|
dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR));
|
||||||
|
|
||||||
set_config("system", "cache_cleared_hour", time());
|
set_config("system", "cache_cleared_hour", time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($max_level <= CACHE_HALF_HOUR) AND (get_config("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
|
if (($max_level <= CACHE_HALF_HOUR) && (get_config("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 30 minutes")), intval(CACHE_HALF_HOUR));
|
dbesc(datetime_convert('UTC','UTC',"now - 30 minutes")), intval(CACHE_HALF_HOUR));
|
||||||
|
|
||||||
set_config("system", "cache_cleared_half_hour", time());
|
set_config("system", "cache_cleared_half_hour", time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($max_level <= CACHE_QUARTER_HOUR) AND (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
|
if (($max_level <= CACHE_QUARTER_HOUR) && (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 15 minutes")), intval(CACHE_QUARTER_HOUR));
|
dbesc(datetime_convert('UTC','UTC',"now - 15 minutes")), intval(CACHE_QUARTER_HOUR));
|
||||||
|
|
||||||
set_config("system", "cache_cleared_quarter_hour", time());
|
set_config("system", "cache_cleared_quarter_hour", time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($max_level <= CACHE_FIVE_MINUTES) AND (get_config("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
|
if (($max_level <= CACHE_FIVE_MINUTES) && (get_config("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 5 minutes")), intval(CACHE_FIVE_MINUTES));
|
dbesc(datetime_convert('UTC','UTC',"now - 5 minutes")), intval(CACHE_FIVE_MINUTES));
|
||||||
|
|
||||||
set_config("system", "cache_cleared_five_minute", time());
|
set_config("system", "cache_cleared_five_minute", time());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($max_level <= CACHE_MINUTE) AND (get_config("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
|
if (($max_level <= CACHE_MINUTE) && (get_config("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
|
||||||
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
|
||||||
dbesc(datetime_convert('UTC','UTC',"now - 1 minutes")), intval(CACHE_MINUTE));
|
dbesc(datetime_convert('UTC','UTC',"now - 1 minutes")), intval(CACHE_MINUTE));
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ function network_to_name($s, $profile = "") {
|
||||||
|
|
||||||
$networkname = str_replace($search, $replace, $s);
|
$networkname = str_replace($search, $replace, $s);
|
||||||
|
|
||||||
if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) AND ($profile != "")) {
|
if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) && ($profile != "")) {
|
||||||
$r = q("SELECT `gserver`.`platform` FROM `gcontact`
|
$r = q("SELECT `gserver`.`platform` FROM `gcontact`
|
||||||
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
|
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
|
||||||
WHERE `gcontact`.`nurl` = '%s' AND `platform` != ''",
|
WHERE `gcontact`.`nurl` = '%s' AND `platform` != ''",
|
||||||
|
|
|
@ -51,7 +51,7 @@ function unavailable_networks() {
|
||||||
$networks[] = NETWORK_APPNET;
|
$networks[] = NETWORK_APPNET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin_enabled("fbpost") AND !plugin_enabled("facebook")) {
|
if (!plugin_enabled("fbpost") && !plugin_enabled("facebook")) {
|
||||||
$networks[] = NETWORK_FACEBOOK;
|
$networks[] = NETWORK_FACEBOOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
$profile_link = zrl($profile_link);
|
$profile_link = zrl($profile_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!x($item, 'author-thumb') OR ($item['author-thumb'] == "")) {
|
if (!x($item, 'author-thumb') || ($item['author-thumb'] == "")) {
|
||||||
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
|
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
|
||||||
if ($author_contact["thumb"]) {
|
if ($author_contact["thumb"]) {
|
||||||
$item['author-thumb'] = $author_contact["thumb"];
|
$item['author-thumb'] = $author_contact["thumb"];
|
||||||
|
@ -721,7 +721,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) {
|
if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) {
|
||||||
$owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
|
$owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
|
||||||
if ($owner_contact["thumb"]) {
|
if ($owner_contact["thumb"]) {
|
||||||
$item['owner-thumb'] = $owner_contact["thumb"];
|
$item['owner-thumb'] = $owner_contact["thumb"];
|
||||||
|
@ -1013,7 +1013,7 @@ function item_photo_menu($item) {
|
||||||
$menu[t("Poke")] = $poke_link;
|
$menu[t("Poke")] = $poke_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($cid == 0) OR ($rel == CONTACT_IS_FOLLOWER)) AND
|
if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) &&
|
||||||
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
|
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
|
||||||
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
|
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,8 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$force = true;
|
$force = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$min_poll_interval = Config::get('system', 'min_poll_interval', 1);
|
||||||
|
|
||||||
$sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");
|
$sql_extra = (($manual_id) ? " AND `id` = $manual_id " : "");
|
||||||
|
|
||||||
reload_plugins();
|
reload_plugins();
|
||||||
|
@ -184,7 +186,7 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$contact['priority'] = 2;
|
$contact['priority'] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
|
if ($contact['subhub'] && in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
|
||||||
/*
|
/*
|
||||||
* We should be getting everything via a hub. But just to be sure, let's check once a day.
|
* We should be getting everything via a hub. But just to be sure, let's check once a day.
|
||||||
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
|
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
|
||||||
|
@ -195,7 +197,7 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['priority'] AND !$force) {
|
if (($contact['priority'] >= 0) && !$force) {
|
||||||
$update = false;
|
$update = false;
|
||||||
|
|
||||||
$t = $contact['last-update'];
|
$t = $contact['last-update'];
|
||||||
|
@ -225,11 +227,16 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
|
||||||
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
|
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + 1 hour")) {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0:
|
||||||
|
default:
|
||||||
|
if (datetime_convert('UTC', 'UTC', 'now') > datetime_convert('UTC', 'UTC', $t . " + ".$min_poll_interval." minute")) {
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -238,11 +245,12 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
|
|
||||||
logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact["nick"] . " " . $contact["name"]);
|
logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact["nick"] . " " . $contact["name"]);
|
||||||
|
|
||||||
if (($contact['network'] == NETWORK_FEED) AND ($contact['priority'] <= 3)) {
|
if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
|
||||||
proc_run(PRIORITY_MEDIUM, 'include/onepoll.php', intval($contact['id']));
|
$priority = PRIORITY_MEDIUM;
|
||||||
} else {
|
} else {
|
||||||
proc_run(PRIORITY_LOW, 'include/onepoll.php', intval($contact['id']));
|
$priority = PRIORITY_LOW;
|
||||||
}
|
}
|
||||||
|
proc_run(array('priority' => $priority, 'dont_fork' => true), 'include/onepoll.php', intval($contact['id']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ function cronhooks_run(&$argv, &$argc) {
|
||||||
|
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
|
|
||||||
if (($argc == 2) AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
|
if (($argc == 2) && is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
|
||||||
foreach ($a->hooks["cron"] as $hook) {
|
foreach ($a->hooks["cron"] as $hook) {
|
||||||
if ($hook[1] == $argv[1]) {
|
if ($hook[1] == $argv[1]) {
|
||||||
logger("Calling cron hook '" . $hook[1] . "'", LOGGER_DEBUG);
|
logger("Calling cron hook '" . $hook[1] . "'", LOGGER_DEBUG);
|
||||||
|
@ -38,7 +38,7 @@ function cronhooks_run(&$argv, &$argc) {
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
if (is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
|
if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
|
||||||
foreach ($a->hooks["cron"] as $hook) {
|
foreach ($a->hooks["cron"] as $hook) {
|
||||||
logger("Calling cronhooks for '" . $hook[1] . "'", LOGGER_DEBUG);
|
logger("Calling cronhooks for '" . $hook[1] . "'", LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]);
|
proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]);
|
||||||
|
|
|
@ -117,7 +117,7 @@ class dba {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the MySQL server version string
|
* @brief Returns the MySQL server version string
|
||||||
*
|
*
|
||||||
* This function discriminate between the deprecated mysql API and the current
|
* This function discriminate between the deprecated mysql API and the current
|
||||||
* object-oriented mysqli API. Example of returned string: 5.5.46-0+deb8u1
|
* object-oriented mysqli API. Example of returned string: 5.5.46-0+deb8u1
|
||||||
*
|
*
|
||||||
|
@ -183,17 +183,17 @@ class dba {
|
||||||
|
|
||||||
foreach ($r AS $row) {
|
foreach ($r AS $row) {
|
||||||
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
|
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
|
||||||
$log = (in_array($row['key'], $watchlist) AND
|
$log = (in_array($row['key'], $watchlist) &&
|
||||||
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
|
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
|
||||||
} else {
|
} else {
|
||||||
$log = false;
|
$log = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) AND ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
|
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) && ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
|
||||||
$log = true;
|
$log = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($row['key'], $blacklist) OR ($row['key'] == "")) {
|
if (in_array($row['key'], $blacklist) || ($row['key'] == "")) {
|
||||||
$log = false;
|
$log = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ class dba {
|
||||||
// PDO doesn't return "true" on successful operations - like mysqli does
|
// PDO doesn't return "true" on successful operations - like mysqli does
|
||||||
// Emulate this behaviour by checking if the query returned data and had columns
|
// Emulate this behaviour by checking if the query returned data and had columns
|
||||||
// This should be reliable enough
|
// This should be reliable enough
|
||||||
if (($this->driver == 'pdo') AND (count($r) == 0) AND ($columns == 0)) {
|
if (($this->driver == 'pdo') && (count($r) == 0) && ($columns == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,6 +459,27 @@ class dba {
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief beautifies the query - useful for "SHOW PROCESSLIST"
|
||||||
|
*
|
||||||
|
* This is safe when we bind the parameters later.
|
||||||
|
* The parameter values aren't part of the SQL.
|
||||||
|
*
|
||||||
|
* @param string $sql An SQL string without the values
|
||||||
|
* @return string The input SQL string modified if necessary.
|
||||||
|
*/
|
||||||
|
public function clean_query($sql) {
|
||||||
|
$search = array("\t", "\n", "\r", " ");
|
||||||
|
$replace = array(' ', ' ', ' ', ' ');
|
||||||
|
do {
|
||||||
|
$oldsql = $sql;
|
||||||
|
$sql = str_replace($search, $replace, $sql);
|
||||||
|
} while ($oldsql != $sql);
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Replaces the ? placeholders with the parameters in the $args array
|
* @brief Replaces the ? placeholders with the parameters in the $args array
|
||||||
*
|
*
|
||||||
|
@ -469,7 +490,7 @@ class dba {
|
||||||
static private function replace_parameters($sql, $args) {
|
static private function replace_parameters($sql, $args) {
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
foreach ($args AS $param => $value) {
|
foreach ($args AS $param => $value) {
|
||||||
if (is_int($args[$param]) OR is_float($args[$param])) {
|
if (is_int($args[$param]) || is_float($args[$param])) {
|
||||||
$replace = intval($args[$param]);
|
$replace = intval($args[$param]);
|
||||||
} else {
|
} else {
|
||||||
$replace = "'".self::$dbo->escape($args[$param])."'";
|
$replace = "'".self::$dbo->escape($args[$param])."'";
|
||||||
|
@ -499,7 +520,7 @@ class dba {
|
||||||
unset($args[0]);
|
unset($args[0]);
|
||||||
|
|
||||||
// When the second function parameter is an array then use this as the parameter array
|
// When the second function parameter is an array then use this as the parameter array
|
||||||
if ((count($args) > 0) AND (is_array($args[1]))) {
|
if ((count($args) > 0) && (is_array($args[1]))) {
|
||||||
$params = $args[1];
|
$params = $args[1];
|
||||||
} else {
|
} else {
|
||||||
$params = $args;
|
$params = $args;
|
||||||
|
@ -512,7 +533,7 @@ class dba {
|
||||||
$args[++$i] = $param;
|
$args[++$i] = $param;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self::$dbo OR !self::$dbo->connected) {
|
if (!self::$dbo || !self::$dbo->connected) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,6 +542,7 @@ class dba {
|
||||||
logger('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), LOGGER_DEBUG);
|
logger('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = self::$dbo->clean_query($sql);
|
||||||
$sql = self::$dbo->any_value_fallback($sql);
|
$sql = self::$dbo->any_value_fallback($sql);
|
||||||
|
|
||||||
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
|
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
|
||||||
|
@ -708,6 +730,9 @@ class dba {
|
||||||
* @return int Number of rows
|
* @return int Number of rows
|
||||||
*/
|
*/
|
||||||
static public function num_rows($stmt) {
|
static public function num_rows($stmt) {
|
||||||
|
if (!is_object($stmt)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
switch (self::$dbo->driver) {
|
switch (self::$dbo->driver) {
|
||||||
case 'pdo':
|
case 'pdo':
|
||||||
return $stmt->rowCount();
|
return $stmt->rowCount();
|
||||||
|
@ -781,6 +806,41 @@ class dba {
|
||||||
return self::e($sql, $param);
|
return self::e($sql, $param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Locks a table for exclusive write access
|
||||||
|
*
|
||||||
|
* This function can be extended in the future to accept a table array as well.
|
||||||
|
*
|
||||||
|
* @param string $table Table name
|
||||||
|
*
|
||||||
|
* @return boolean was the lock successful?
|
||||||
|
*/
|
||||||
|
static public function lock($table) {
|
||||||
|
// See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html
|
||||||
|
self::e("SET autocommit=0");
|
||||||
|
$success = self::e("LOCK TABLES `".self::$dbo->escape($table)."` WRITE");
|
||||||
|
if (!$success) {
|
||||||
|
self::e("SET autocommit=1");
|
||||||
|
} else {
|
||||||
|
self::$in_transaction = true;
|
||||||
|
}
|
||||||
|
return $success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Unlocks all locked tables
|
||||||
|
*
|
||||||
|
* @return boolean was the unlock successful?
|
||||||
|
*/
|
||||||
|
static public function unlock() {
|
||||||
|
// See here: https://dev.mysql.com/doc/refman/5.7/en/lock-tables-and-transactions.html
|
||||||
|
self::e("COMMIT");
|
||||||
|
$success = self::e("UNLOCK TABLES");
|
||||||
|
self::e("SET autocommit=1");
|
||||||
|
self::$in_transaction = false;
|
||||||
|
return $success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Starts a transaction
|
* @brief Starts a transaction
|
||||||
*
|
*
|
||||||
|
@ -888,7 +948,7 @@ class dba {
|
||||||
|
|
||||||
// When the search field is the relation field, we don't need to fetch the rows
|
// When the search field is the relation field, we don't need to fetch the rows
|
||||||
// This is useful when the leading record is already deleted in the frontend but the rest is done in the backend
|
// This is useful when the leading record is already deleted in the frontend but the rest is done in the backend
|
||||||
if ((count($param) == 1) AND ($field == array_keys($param)[0])) {
|
if ((count($param) == 1) && ($field == array_keys($param)[0])) {
|
||||||
foreach ($rel_def AS $rel_table => $rel_fields) {
|
foreach ($rel_def AS $rel_table => $rel_fields) {
|
||||||
foreach ($rel_fields AS $rel_field) {
|
foreach ($rel_fields AS $rel_field) {
|
||||||
$retval = self::delete($rel_table, array($rel_field => array_values($param)[0]), true, $callstack);
|
$retval = self::delete($rel_table, array($rel_field => array_values($param)[0]), true, $callstack);
|
||||||
|
@ -1050,7 +1110,7 @@ class dba {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$do_update OR (count($fields) == 0)) {
|
if (!$do_update || (count($fields) == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1130,7 +1190,7 @@ class dba {
|
||||||
|
|
||||||
$result = self::p($sql, $condition);
|
$result = self::p($sql, $condition);
|
||||||
|
|
||||||
if (is_bool($result) OR !$single_row) {
|
if (is_bool($result) || !$single_row) {
|
||||||
return $result;
|
return $result;
|
||||||
} else {
|
} else {
|
||||||
$row = self::fetch($result);
|
$row = self::fetch($result);
|
||||||
|
@ -1200,6 +1260,7 @@ function q($sql) {
|
||||||
unset($args[0]);
|
unset($args[0]);
|
||||||
|
|
||||||
if ($db && $db->connected) {
|
if ($db && $db->connected) {
|
||||||
|
$sql = $db->clean_query($sql);
|
||||||
$sql = $db->any_value_fallback($sql);
|
$sql = $db->any_value_fallback($sql);
|
||||||
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
||||||
//logger("dba: q: $stmt", LOGGER_ALL);
|
//logger("dba: q: $stmt", LOGGER_ALL);
|
||||||
|
@ -1237,6 +1298,7 @@ function qu($sql) {
|
||||||
unset($args[0]);
|
unset($args[0]);
|
||||||
|
|
||||||
if ($db && $db->connected) {
|
if ($db && $db->connected) {
|
||||||
|
$sql = $db->clean_query($sql);
|
||||||
$sql = $db->any_value_fallback($sql);
|
$sql = $db->any_value_fallback($sql);
|
||||||
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
$stmt = @vsprintf($sql,$args); // Disabled warnings
|
||||||
if ($stmt === false)
|
if ($stmt === false)
|
||||||
|
|
|
@ -190,14 +190,14 @@ class dba {
|
||||||
* regardless of any logging that may or may nor be in effect.
|
* regardless of any logging that may or may nor be in effect.
|
||||||
* These usually indicate SQL syntax errors that need to be resolved.
|
* These usually indicate SQL syntax errors that need to be resolved.
|
||||||
*/
|
*/
|
||||||
if (isset($result) AND ($result === false)) {
|
if (isset($result) && ($result === false)) {
|
||||||
logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
|
logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
|
||||||
if (file_exists('dbfail.out')) {
|
if (file_exists('dbfail.out')) {
|
||||||
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
|
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($result) AND (($result === true) || ($result === false))) {
|
if (isset($result) && (($result === true) || ($result === false))) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,14 @@ function dbclean_run(&$argv, &$argc) {
|
||||||
$stage = 0;
|
$stage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the expire days for step 8 and 9
|
||||||
|
$days = Config::get('system', 'dbclean-expire-days', 0);
|
||||||
|
|
||||||
if ($stage == 0) {
|
if ($stage == 0) {
|
||||||
for ($i = 1; $i <= 7; $i++) {
|
for ($i = 1; $i <= 9; $i++) {
|
||||||
if (!Config::get('system', 'finished-dbclean-'.$i)) {
|
// Execute the background script for a step when it isn't finished.
|
||||||
|
// Execute step 8 and 9 only when $days is defined.
|
||||||
|
if (!Config::get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($days > 0))) {
|
||||||
proc_run(PRIORITY_LOW, 'include/dbclean.php', $i);
|
proc_run(PRIORITY_LOW, 'include/dbclean.php', $i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +35,19 @@ function dbclean_run(&$argv, &$argc) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove orphaned database entries
|
* @brief Remove orphaned database entries
|
||||||
|
* @param integer $stage What should be deleted?
|
||||||
|
*
|
||||||
|
* Values for $stage:
|
||||||
|
* ------------------
|
||||||
|
* 1: Old global item entries from item table without user copy.
|
||||||
|
* 2: Items without parents.
|
||||||
|
* 3: Orphaned data from thread table.
|
||||||
|
* 4: Orphaned data from notify table.
|
||||||
|
* 5: Orphaned data from notify-threads table.
|
||||||
|
* 6: Orphaned data from sign table.
|
||||||
|
* 7: Orphaned data from term table.
|
||||||
|
* 8: Expired threads.
|
||||||
|
* 9: Old global item entries from expired threads
|
||||||
*/
|
*/
|
||||||
function remove_orphans($stage = 0) {
|
function remove_orphans($stage = 0) {
|
||||||
global $db;
|
global $db;
|
||||||
|
@ -39,141 +57,246 @@ function remove_orphans($stage = 0) {
|
||||||
// We split the deletion in many small tasks
|
// We split the deletion in many small tasks
|
||||||
$limit = 1000;
|
$limit = 1000;
|
||||||
|
|
||||||
|
// Get the expire days for step 8 and 9
|
||||||
|
$days = Config::get('system', 'dbclean-expire-days', 0);
|
||||||
|
|
||||||
if ($stage == 1) {
|
if ($stage == 1) {
|
||||||
logger("Deleting old global item entries from item table without user copy");
|
$last_id = Config::get('system', 'dbclean-last-id-1', 0);
|
||||||
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0
|
|
||||||
AND NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0)
|
logger("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||||
AND `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY LIMIT ".intval($limit));
|
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||||
|
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||||
|
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ?
|
||||||
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found global item orphans: ".$count);
|
logger("found global item orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
dba::delete('item', array('id' => $orphan["id"]));
|
dba::delete('item', array('id' => $orphan["id"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No global item orphans found");
|
logger("No global item orphans found");
|
||||||
|
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." old global item entries from item table without user copy");
|
logger("Done deleting ".$count." old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||||
|
|
||||||
// We will eventually set this value when we found a good way to delete these items in another way.
|
Config::set('system', 'dbclean-last-id-1', $last_id);
|
||||||
// if ($count < $limit) {
|
|
||||||
// Config::set('system', 'finished-dbclean-1', true);
|
|
||||||
// }
|
|
||||||
} elseif ($stage == 2) {
|
} elseif ($stage == 2) {
|
||||||
logger("Deleting items without parents");
|
$last_id = Config::get('system', 'dbclean-last-id-2', 0);
|
||||||
$r = dba::p("SELECT `id` FROM `item` WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting items without parents. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `id` FROM `item`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
||||||
|
AND `id` >= ? ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found item orphans without parents: ".$count);
|
logger("found item orphans without parents: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
dba::delete('item', array('id' => $orphan["id"]));
|
dba::delete('item', array('id' => $orphan["id"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No item orphans without parents found");
|
logger("No item orphans without parents found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." items without parents");
|
logger("Done deleting ".$count." items without parents. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-2', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-2', true);
|
Config::set('system', 'finished-dbclean-2', true);
|
||||||
}
|
}
|
||||||
} elseif ($stage == 3) {
|
} elseif ($stage == 3) {
|
||||||
logger("Deleting orphaned data from thread table");
|
$last_id = Config::get('system', 'dbclean-last-id-3', 0);
|
||||||
$r = dba::p("SELECT `iid` FROM `thread` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting orphaned data from thread table. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `iid` FROM `thread`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) AND `iid` >= ?
|
||||||
|
ORDER BY `iid` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found thread orphans: ".$count);
|
logger("found thread orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["iid"];
|
||||||
dba::delete('thread', array('iid' => $orphan["iid"]));
|
dba::delete('thread', array('iid' => $orphan["iid"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No thread orphans found");
|
logger("No thread orphans found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." orphaned data from thread table");
|
logger("Done deleting ".$count." orphaned data from thread table. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-3', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-3', true);
|
Config::set('system', 'finished-dbclean-3', true);
|
||||||
}
|
}
|
||||||
} elseif ($stage == 4) {
|
} elseif ($stage == 4) {
|
||||||
logger("Deleting orphaned data from notify table");
|
$last_id = Config::get('system', 'dbclean-last-id-4', 0);
|
||||||
$r = dba::p("SELECT `iid` FROM `notify` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting orphaned data from notify table. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `iid`, `id` FROM `notify`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) AND `id` >= ?
|
||||||
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found notify orphans: ".$count);
|
logger("found notify orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
dba::delete('notify', array('iid' => $orphan["iid"]));
|
dba::delete('notify', array('iid' => $orphan["iid"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No notify orphans found");
|
logger("No notify orphans found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." orphaned data from notify table");
|
logger("Done deleting ".$count." orphaned data from notify table. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-4', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-4', true);
|
Config::set('system', 'finished-dbclean-4', true);
|
||||||
}
|
}
|
||||||
} elseif ($stage == 5) {
|
} elseif ($stage == 5) {
|
||||||
logger("Deleting orphaned data from notify-threads table");
|
$last_id = Config::get('system', 'dbclean-last-id-5', 0);
|
||||||
$r = dba::p("SELECT `id` FROM `notify-threads` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `id` FROM `notify-threads`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) AND `id` >= ?
|
||||||
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found notify-threads orphans: ".$count);
|
logger("found notify-threads orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
dba::delete('notify-threads', array('id' => $orphan["id"]));
|
dba::delete('notify-threads', array('id' => $orphan["id"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No notify-threads orphans found");
|
logger("No notify-threads orphans found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." orphaned data from notify-threads table");
|
logger("Done deleting ".$count." orphaned data from notify-threads table. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-5', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-5', true);
|
Config::set('system', 'finished-dbclean-5', true);
|
||||||
}
|
}
|
||||||
} elseif ($stage == 6) {
|
} elseif ($stage == 6) {
|
||||||
logger("Deleting orphaned data from sign table");
|
$last_id = Config::get('system', 'dbclean-last-id-6', 0);
|
||||||
$r = dba::p("SELECT `iid` FROM `sign` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting orphaned data from sign table. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `iid`, `id` FROM `sign`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) AND `id` >= ?
|
||||||
|
ORDER BY `id` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found sign orphans: ".$count);
|
logger("found sign orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
dba::delete('sign', array('iid' => $orphan["iid"]));
|
dba::delete('sign', array('iid' => $orphan["iid"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No sign orphans found");
|
logger("No sign orphans found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." orphaned data from sign table");
|
logger("Done deleting ".$count." orphaned data from sign table. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-6', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-6', true);
|
Config::set('system', 'finished-dbclean-6', true);
|
||||||
}
|
}
|
||||||
} elseif ($stage == 7) {
|
} elseif ($stage == 7) {
|
||||||
logger("Deleting orphaned data from term table");
|
$last_id = Config::get('system', 'dbclean-last-id-7', 0);
|
||||||
$r = dba::p("SELECT `oid` FROM `term` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) LIMIT ".intval($limit));
|
|
||||||
|
logger("Deleting orphaned data from term table. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `oid`, `tid` FROM `term`
|
||||||
|
WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) AND `tid` >= ?
|
||||||
|
ORDER BY `tid` LIMIT ".intval($limit), $last_id);
|
||||||
$count = dba::num_rows($r);
|
$count = dba::num_rows($r);
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
logger("found term orphans: ".$count);
|
logger("found term orphans: ".$count);
|
||||||
while ($orphan = dba::fetch($r)) {
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["tid"];
|
||||||
dba::delete('term', array('oid' => $orphan["oid"]));
|
dba::delete('term', array('oid' => $orphan["oid"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logger("No term orphans found");
|
logger("No term orphans found");
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
logger("Done deleting ".$count." orphaned data from term table");
|
logger("Done deleting ".$count." orphaned data from term table. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-7', $last_id);
|
||||||
|
|
||||||
if ($count < $limit) {
|
if ($count < $limit) {
|
||||||
Config::set('system', 'finished-dbclean-7', true);
|
Config::set('system', 'finished-dbclean-7', true);
|
||||||
}
|
}
|
||||||
|
} elseif ($stage == 8) {
|
||||||
|
if ($days <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||||
|
|
||||||
|
logger("Deleting expired threads. Last ID: ".$last_id);
|
||||||
|
$r = dba::p("SELECT `thread`.`iid` FROM `thread`
|
||||||
|
INNER JOIN `contact` ON `thread`.`contact-id` = `contact`.`id` AND NOT `notify_new_posts`
|
||||||
|
WHERE `thread`.`received` < UTC_TIMESTAMP() - INTERVAL ? DAY
|
||||||
|
AND NOT `thread`.`mention` AND NOT `thread`.`starred`
|
||||||
|
AND NOT `thread`.`wall` AND NOT `thread`.`origin`
|
||||||
|
AND `thread`.`uid` != 0 AND `thread`.`iid` >= ?
|
||||||
|
AND NOT `thread`.`iid` IN (SELECT `parent` FROM `item`
|
||||||
|
WHERE (`item`.`starred` OR (`item`.`resource-id` != '')
|
||||||
|
OR (`item`.`file` != '') OR (`item`.`event-id` != '')
|
||||||
|
OR (`item`.`attach` != '') OR `item`.`wall` OR `item`.`origin`)
|
||||||
|
AND `item`.`parent` = `thread`.`iid`)
|
||||||
|
ORDER BY `thread`.`iid` LIMIT 1000", $days, $last_id);
|
||||||
|
$count = dba::num_rows($r);
|
||||||
|
if ($count > 0) {
|
||||||
|
logger("found expired threads: ".$count);
|
||||||
|
while ($thread = dba::fetch($r)) {
|
||||||
|
$last_id = $thread["iid"];
|
||||||
|
dba::delete('thread', array('iid' => $thread["iid"]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger("No expired threads found");
|
||||||
|
}
|
||||||
|
dba::close($r);
|
||||||
|
logger("Done deleting ".$count." expired threads. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-8', $last_id);
|
||||||
|
} elseif ($stage == 9) {
|
||||||
|
if ($days <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_id = Config::get('system', 'dbclean-last-id-9', 0);
|
||||||
|
$till_id = Config::get('system', 'dbclean-last-id-8', 0);
|
||||||
|
|
||||||
|
logger("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
|
||||||
|
$r = dba::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||||
|
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||||
|
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
||||||
|
ORDER BY `id` LIMIT ".intval($limit), $last_id, $till_id);
|
||||||
|
$count = dba::num_rows($r);
|
||||||
|
if ($count > 0) {
|
||||||
|
logger("found global item entries from expired threads: ".$count);
|
||||||
|
while ($orphan = dba::fetch($r)) {
|
||||||
|
$last_id = $orphan["id"];
|
||||||
|
dba::delete('item', array('id' => $orphan["id"]));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger("No global item entries from expired threads");
|
||||||
|
}
|
||||||
|
dba::close($r);
|
||||||
|
logger("Done deleting ".$count." old global item entries from expired threads. Last ID: ".$last_id);
|
||||||
|
|
||||||
|
Config::set('system', 'dbclean-last-id-9', $last_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call it again if not all entries were purged
|
// Call it again if not all entries were purged
|
||||||
if (($stage != 0) AND ($count > 0)) {
|
if (($stage != 0) && ($count > 0)) {
|
||||||
proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
|
proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class dbm {
|
||||||
|
|
||||||
if (is_bool($value)) {
|
if (is_bool($value)) {
|
||||||
$value = ($value ? 'true' : 'false');
|
$value = ($value ? 'true' : 'false');
|
||||||
} elseif (is_float($value) OR is_integer($value)) {
|
} elseif (is_float($value) || is_integer($value)) {
|
||||||
$value = (string)$value;
|
$value = (string)$value;
|
||||||
} else {
|
} else {
|
||||||
$value = "'".dbesc($value)."'";
|
$value = "'".dbesc($value)."'";
|
||||||
|
|
|
@ -8,7 +8,11 @@ require_once "include/text.php";
|
||||||
|
|
||||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||||
|
|
||||||
/**
|
const DB_UPDATE_NOT_CHECKED = 0; // Database check wasn't executed before
|
||||||
|
const DB_UPDATE_SUCCESSFUL = 1; // Database check was successful
|
||||||
|
const DB_UPDATE_FAILED = 2; // Database check failed
|
||||||
|
|
||||||
|
/*
|
||||||
* Converts all tables from MyISAM to InnoDB
|
* Converts all tables from MyISAM to InnoDB
|
||||||
*/
|
*/
|
||||||
function convert_to_innodb() {
|
function convert_to_innodb() {
|
||||||
|
@ -130,7 +134,7 @@ function table_structure($table) {
|
||||||
// On utf8mb4 a varchar index can only have a length of 191
|
// On utf8mb4 a varchar index can only have a length of 191
|
||||||
// The "show index" command sometimes returns this value although this value wasn't added manually.
|
// The "show index" command sometimes returns this value although this value wasn't added manually.
|
||||||
// Because we don't want to add this number to every index, we ignore bigger numbers
|
// Because we don't want to add this number to every index, we ignore bigger numbers
|
||||||
if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 191) OR ($index["Key_name"] == "PRIMARY"))) {
|
if (($index["Sub_part"] != "") && (($index["Sub_part"] < 191) || ($index["Key_name"] == "PRIMARY"))) {
|
||||||
$column .= "(".$index["Sub_part"].")";
|
$column .= "(".$index["Sub_part"].")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +233,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
||||||
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
|
if ((version_compare($db->server_info(), '5.7.4') >= 0) &&
|
||||||
!(strpos($db->server_info(), 'MariaDB') !== false)) {
|
!(strpos($db->server_info(), 'MariaDB') !== false)) {
|
||||||
$ignore = '';
|
$ignore = '';
|
||||||
} else {
|
} else {
|
||||||
|
@ -378,7 +382,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
$field_definition = $database[$name]["fields"][$fieldname];
|
$field_definition = $database[$name]["fields"][$fieldname];
|
||||||
|
|
||||||
// Define the default collation if not given
|
// Define the default collation if not given
|
||||||
if (!isset($parameters['Collation']) AND !is_null($field_definition['Collation'])) {
|
if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
|
||||||
$parameters['Collation'] = 'utf8mb4_general_ci';
|
$parameters['Collation'] = 'utf8mb4_general_ci';
|
||||||
} else {
|
} else {
|
||||||
$parameters['Collation'] = null;
|
$parameters['Collation'] = null;
|
||||||
|
@ -386,7 +390,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
|
|
||||||
if ($field_definition['Collation'] != $parameters['Collation']) {
|
if ($field_definition['Collation'] != $parameters['Collation']) {
|
||||||
$sql2 = db_modify_table_field($fieldname, $parameters);
|
$sql2 = db_modify_table_field($fieldname, $parameters);
|
||||||
if (($sql3 == "") OR (substr($sql3, -2, 2) == "; ")) {
|
if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
|
||||||
$sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
|
$sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
|
||||||
} else {
|
} else {
|
||||||
$sql3 .= ", ".$sql2;
|
$sql3 .= ", ".$sql2;
|
||||||
|
@ -481,6 +485,12 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
Config::set('system', 'maintenance_reason', '');
|
Config::set('system', 'maintenance_reason', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($errors) {
|
||||||
|
Config::set('system', 'dbupdate', DB_UPDATE_FAILED);
|
||||||
|
} else {
|
||||||
|
Config::set('system', 'dbupdate', DB_UPDATE_SUCCESSFUL);
|
||||||
|
}
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +514,7 @@ function db_field_command($parameters, $create = true) {
|
||||||
if ($parameters["extra"] != "")
|
if ($parameters["extra"] != "")
|
||||||
$fieldstruct .= " ".$parameters["extra"];
|
$fieldstruct .= " ".$parameters["extra"];
|
||||||
|
|
||||||
/*if (($parameters["primary"] != "") AND $create)
|
/*if (($parameters["primary"] != "") && $create)
|
||||||
$fieldstruct .= " PRIMARY KEY";*/
|
$fieldstruct .= " PRIMARY KEY";*/
|
||||||
|
|
||||||
return($fieldstruct);
|
return($fieldstruct);
|
||||||
|
@ -521,7 +531,7 @@ function db_create_table($name, $fields, $verbose, $action, $indexes=null) {
|
||||||
$primary_keys = array();
|
$primary_keys = array();
|
||||||
foreach ($fields AS $fieldname => $field) {
|
foreach ($fields AS $fieldname => $field) {
|
||||||
$sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
|
$sql_rows[] = "`".dbesc($fieldname)."` ".db_field_command($field);
|
||||||
if (x($field,'primary') and $field['primary']!='') {
|
if (x($field,'primary') && $field['primary']!='') {
|
||||||
$primary_keys[] = $fieldname;
|
$primary_keys[] = $fieldname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,7 +819,7 @@ function db_definition() {
|
||||||
$database["conv"] = array(
|
$database["conv"] = array(
|
||||||
"fields" => array(
|
"fields" => array(
|
||||||
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||||
"guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
|
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"recips" => array("type" => "text"),
|
"recips" => array("type" => "text"),
|
||||||
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
|
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
|
||||||
"creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
"creator" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
|
@ -1196,7 +1206,7 @@ function db_definition() {
|
||||||
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||||
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
"name" => array("type" => "varchar(128)", "not null" => "1", "default" => ""),
|
||||||
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
"locked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
|
||||||
"created" => array("type" => "datetime", "default" => NULL_DATE),
|
"pid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
|
@ -1206,7 +1216,7 @@ function db_definition() {
|
||||||
"fields" => array(
|
"fields" => array(
|
||||||
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
|
||||||
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
|
"uid" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0", "relation" => array("user" => "uid")),
|
||||||
"guid" => array("type" => "varchar(64)", "not null" => "1", "default" => ""),
|
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
"from-name" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
"from-photo" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
"from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
"from-url" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
|
||||||
|
@ -1733,6 +1743,9 @@ function db_definition() {
|
||||||
),
|
),
|
||||||
"indexes" => array(
|
"indexes" => array(
|
||||||
"PRIMARY" => array("id"),
|
"PRIMARY" => array("id"),
|
||||||
|
"pid" => array("pid"),
|
||||||
|
"parameter" => array("parameter(64)"),
|
||||||
|
"priority_created" => array("priority", "created"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
$uid = $item_id;
|
$uid = $item_id;
|
||||||
} else {
|
} else {
|
||||||
// find ancestors
|
// find ancestors
|
||||||
$r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1",
|
$r = q("SELECT * FROM `item` WHERE `id` = %d AND visible = 1 AND moderated = 0 LIMIT 1",
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
$updated = $r[0]['edited'];
|
$updated = $r[0]['edited'];
|
||||||
|
|
||||||
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
||||||
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d and visible = 1 and moderated = 0 ORDER BY `id` ASC",
|
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible = 1 AND moderated = 0 ORDER BY `id` ASC",
|
||||||
intval($parent_id)
|
intval($parent_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
|
|
||||||
// If we are setup as a soapbox we aren't accepting top level posts from this person
|
// If we are setup as a soapbox we aren't accepting top level posts from this person
|
||||||
|
|
||||||
if (($x[0]['page-flags'] == PAGE_SOAPBOX) AND $top_level) {
|
if (($x[0]['page-flags'] == PAGE_SOAPBOX) && $top_level) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger('mod-delivery: local delivery');
|
logger('mod-delivery: local delivery');
|
||||||
|
@ -453,7 +453,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
$headers .= "References: <".iri2msgid($it["parent-uri"]).">";
|
$headers .= "References: <".iri2msgid($it["parent-uri"]).">";
|
||||||
|
|
||||||
// If Threading is enabled, write down the correct parent
|
// If Threading is enabled, write down the correct parent
|
||||||
if (($it["thr-parent"] != "") and ($it["thr-parent"] != $it["parent-uri"]))
|
if (($it["thr-parent"] != "") && ($it["thr-parent"] != $it["parent-uri"]))
|
||||||
$headers .= " <".iri2msgid($it["thr-parent"]).">";
|
$headers .= " <".iri2msgid($it["thr-parent"]).">";
|
||||||
$headers .= "\n";
|
$headers .= "\n";
|
||||||
|
|
||||||
|
@ -462,14 +462,14 @@ function delivery_run(&$argv, &$argc){
|
||||||
dbesc($it['parent-uri']),
|
dbesc($it['parent-uri']),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (dbm::is_result($r) AND ($r[0]['title'] != '')) {
|
if (dbm::is_result($r) && ($r[0]['title'] != '')) {
|
||||||
$subject = $r[0]['title'];
|
$subject = $r[0]['title'];
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($it['parent-uri']),
|
dbesc($it['parent-uri']),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (dbm::is_result($r) AND ($r[0]['title'] != ''))
|
if (dbm::is_result($r) && ($r[0]['title'] != ''))
|
||||||
$subject = $r[0]['title'];
|
$subject = $r[0]['title'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ class dfrn {
|
||||||
/// @TODO This hook can't work anymore
|
/// @TODO This hook can't work anymore
|
||||||
// call_hooks('atom_feed', $atom);
|
// call_hooks('atom_feed', $atom);
|
||||||
|
|
||||||
if (!dbm::is_result($items) OR $onlyheader) {
|
if (!dbm::is_result($items) || $onlyheader) {
|
||||||
$atom = trim($doc->saveXML());
|
$atom = trim($doc->saveXML());
|
||||||
|
|
||||||
call_hooks('atom_feed_end', $atom);
|
call_hooks('atom_feed_end', $atom);
|
||||||
|
@ -284,6 +284,62 @@ class dfrn {
|
||||||
return $atom;
|
return $atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Generate an atom entry for a given item id
|
||||||
|
*
|
||||||
|
* @param int $item_id The item id
|
||||||
|
*
|
||||||
|
* @return string DFRN feed entry
|
||||||
|
*/
|
||||||
|
public static function itemFeed($item_id) {
|
||||||
|
$r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||||
|
`contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
|
||||||
|
`contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
|
||||||
|
`contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
|
||||||
|
`sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
|
||||||
|
FROM `item`
|
||||||
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||||
|
AND (NOT `contact`.`blocked` OR `contact`.`pending`)
|
||||||
|
LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
|
||||||
|
WHERE `item`.`id` = %d AND `item`.`visible` AND NOT `item`.`moderated` AND `item`.`parent` != 0
|
||||||
|
AND `item`.`wall` AND NOT `item`.`private`",
|
||||||
|
intval($item_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$item = $r[0];
|
||||||
|
|
||||||
|
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`, `user`.`account-type`
|
||||||
|
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
|
||||||
|
WHERE `contact`.`self` AND `user`.`uid` = %d LIMIT 1",
|
||||||
|
intval($item['uid'])
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
|
$owner = $r[0];
|
||||||
|
|
||||||
|
$doc = new DOMDocument('1.0', 'utf-8');
|
||||||
|
$doc->formatOutput = true;
|
||||||
|
|
||||||
|
$alternatelink = $owner['url'];
|
||||||
|
|
||||||
|
$root = self::add_header($doc, $owner, 'dfrn:owner', $alternatelink, true);
|
||||||
|
|
||||||
|
$type = 'html';
|
||||||
|
|
||||||
|
$entry = self::entry($doc, $type, $item, $owner, true);
|
||||||
|
$root->appendChild($entry);
|
||||||
|
|
||||||
|
$atom = trim($doc->saveXML());
|
||||||
|
return $atom;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create XML text for DFRN mails
|
* @brief Create XML text for DFRN mails
|
||||||
*
|
*
|
||||||
|
@ -508,7 +564,7 @@ class dfrn {
|
||||||
|
|
||||||
$attributes = array();
|
$attributes = array();
|
||||||
|
|
||||||
if (!$public OR !$hidewall) {
|
if (!$public || !$hidewall) {
|
||||||
$attributes = array("dfrn:updated" => $namdate);
|
$attributes = array("dfrn:updated" => $namdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +575,7 @@ class dfrn {
|
||||||
$attributes = array("rel" => "photo", "type" => "image/jpeg",
|
$attributes = array("rel" => "photo", "type" => "image/jpeg",
|
||||||
"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
|
"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
|
||||||
|
|
||||||
if (!$public OR !$hidewall) {
|
if (!$public || !$hidewall) {
|
||||||
$attributes["dfrn:updated"] = $picdate;
|
$attributes["dfrn:updated"] = $picdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,7 +977,7 @@ class dfrn {
|
||||||
|
|
||||||
if (count($tags)) {
|
if (count($tags)) {
|
||||||
foreach ($tags as $t) {
|
foreach ($tags as $t) {
|
||||||
if (($type != 'html') OR ($t[0] != "@")) {
|
if (($type != 'html') || ($t[0] != "@")) {
|
||||||
xml::add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]));
|
xml::add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -940,7 +996,7 @@ class dfrn {
|
||||||
intval($owner["uid"]),
|
intval($owner["uid"]),
|
||||||
dbesc(normalise_link($mention)));
|
dbesc(normalise_link($mention)));
|
||||||
|
|
||||||
if (dbm::is_result($r) AND ($r[0]["forum"] OR $r[0]["prv"])) {
|
if (dbm::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
|
||||||
xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
|
xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
|
||||||
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
|
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
|
||||||
"href" => $mention));
|
"href" => $mention));
|
||||||
|
@ -1323,7 +1379,7 @@ class dfrn {
|
||||||
$contact["avatar-date"] = $attributes->textContent;
|
$contact["avatar-date"] = $attributes->textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($width > 0) AND ($href != "")) {
|
if (($width > 0) && ($href != "")) {
|
||||||
$avatarlist[$width] = $href;
|
$avatarlist[$width] = $href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1332,7 +1388,7 @@ class dfrn {
|
||||||
$author["avatar"] = current($avatarlist);
|
$author["avatar"] = current($avatarlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbm::is_result($r) AND !$onlyfetch) {
|
if (dbm::is_result($r) && !$onlyfetch) {
|
||||||
logger("Check if contact details for contact " . $r[0]["id"] . " (" . $r[0]["nick"] . ") have to be updated.", LOGGER_DEBUG);
|
logger("Check if contact details for contact " . $r[0]["id"] . " (" . $r[0]["nick"] . ") have to be updated.", LOGGER_DEBUG);
|
||||||
|
|
||||||
$poco = array("url" => $contact["url"]);
|
$poco = array("url" => $contact["url"]);
|
||||||
|
@ -1774,7 +1830,7 @@ class dfrn {
|
||||||
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
|
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
|
||||||
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
|
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
|
||||||
|
|
||||||
if (($relocate["avatar"] == "") AND ($relocate["photo"] != "")) {
|
if (($relocate["avatar"] == "") && ($relocate["photo"] != "")) {
|
||||||
$relocate["avatar"] = $relocate["photo"];
|
$relocate["avatar"] = $relocate["photo"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1922,7 +1978,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update last-child if it changes
|
// update last-child if it changes
|
||||||
if ($item["last-child"] AND ($item["last-child"] != $current["last-child"])) {
|
if ($item["last-child"] && ($item["last-child"] != $current["last-child"])) {
|
||||||
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc($item["parent-uri"]),
|
dbesc($item["parent-uri"]),
|
||||||
|
@ -2206,7 +2262,7 @@ class dfrn {
|
||||||
$title = $attributes->textContent;
|
$title = $attributes->textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($rel != "") AND ($href != "")) {
|
if (($rel != "") && ($href != "")) {
|
||||||
switch ($rel) {
|
switch ($rel) {
|
||||||
case "alternate":
|
case "alternate":
|
||||||
$item["plink"] = $href;
|
$item["plink"] = $href;
|
||||||
|
@ -2254,7 +2310,7 @@ class dfrn {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Is there an existing item?
|
// Is there an existing item?
|
||||||
if (dbm::is_result($current) AND edited_timestamp_is_newer($current[0], $item) AND
|
if (dbm::is_result($current) && edited_timestamp_is_newer($current[0], $item) &&
|
||||||
(datetime_convert("UTC","UTC",$item["edited"]) < $current[0]["edited"])) {
|
(datetime_convert("UTC","UTC",$item["edited"]) < $current[0]["edited"])) {
|
||||||
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
@ -2328,7 +2384,7 @@ class dfrn {
|
||||||
}
|
}
|
||||||
|
|
||||||
$notice_info = $xpath->query("statusnet:notice_info", $entry);
|
$notice_info = $xpath->query("statusnet:notice_info", $entry);
|
||||||
if ($notice_info AND ($notice_info->length > 0)) {
|
if ($notice_info && ($notice_info->length > 0)) {
|
||||||
foreach ($notice_info->item(0)->attributes AS $attributes) {
|
foreach ($notice_info->item(0)->attributes AS $attributes) {
|
||||||
if ($attributes->name == "source") {
|
if ($attributes->name == "source") {
|
||||||
$item["app"] = strip_tags($attributes->textContent);
|
$item["app"] = strip_tags($attributes->textContent);
|
||||||
|
@ -2378,9 +2434,9 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($term != "") AND ($scheme != "")) {
|
if (($term != "") && ($scheme != "")) {
|
||||||
$parts = explode(":", $scheme);
|
$parts = explode(":", $scheme);
|
||||||
if ((count($parts) >= 4) AND (array_shift($parts) == "X-DFRN")) {
|
if ((count($parts) >= 4) && (array_shift($parts) == "X-DFRN")) {
|
||||||
$termhash = array_shift($parts);
|
$termhash = array_shift($parts);
|
||||||
$termurl = implode(":", $parts);
|
$termurl = implode(":", $parts);
|
||||||
|
|
||||||
|
@ -2440,7 +2496,7 @@ class dfrn {
|
||||||
$item["contact-id"] = $owner["contact-id"];
|
$item["contact-id"] = $owner["contact-id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item["network"] != $owner["network"]) AND ($owner["network"] != "")) {
|
if (($item["network"] != $owner["network"]) && ($owner["network"] != "")) {
|
||||||
$item["network"] = $owner["network"];
|
$item["network"] = $owner["network"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2448,7 +2504,7 @@ class dfrn {
|
||||||
$item["contact-id"] = $author["contact-id"];
|
$item["contact-id"] = $author["contact-id"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item["network"] != $author["network"]) AND ($author["network"] != "")) {
|
if (($item["network"] != $author["network"]) && ($author["network"] != "")) {
|
||||||
$item["network"] = $author["network"];
|
$item["network"] = $author["network"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2548,7 +2604,7 @@ class dfrn {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($posted_id AND $parent AND ($entrytype == DFRN_REPLY_RC)) {
|
if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
|
||||||
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
|
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $posted_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $posted_id);
|
||||||
}
|
}
|
||||||
|
@ -2613,7 +2669,7 @@ class dfrn {
|
||||||
$when = datetime_convert("UTC", "UTC", "now", "Y-m-d H:i:s");
|
$when = datetime_convert("UTC", "UTC", "now", "Y-m-d H:i:s");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$uri OR !$importer["id"]) {
|
if (!$uri || !$importer["id"]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,7 +416,7 @@ class Diaspora {
|
||||||
$fields = $postdata['fields'];
|
$fields = $postdata['fields'];
|
||||||
|
|
||||||
// Is it a an action (comment, like, ...) for our own post?
|
// Is it a an action (comment, like, ...) for our own post?
|
||||||
if (isset($fields->parent_guid) AND !$postdata["relayed"]) {
|
if (isset($fields->parent_guid) && !$postdata["relayed"]) {
|
||||||
$guid = notags(unxmlify($fields->parent_guid));
|
$guid = notags(unxmlify($fields->parent_guid));
|
||||||
$importer = self::importer_for_guid($guid);
|
$importer = self::importer_for_guid($guid);
|
||||||
if (is_array($importer)) {
|
if (is_array($importer)) {
|
||||||
|
@ -612,9 +612,9 @@ class Diaspora {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($fieldname == "author_signature") AND ($entry != ""))
|
if (($fieldname == "author_signature") && ($entry != ""))
|
||||||
$author_signature = base64_decode($entry);
|
$author_signature = base64_decode($entry);
|
||||||
elseif (($fieldname == "parent_author_signature") AND ($entry != ""))
|
elseif (($fieldname == "parent_author_signature") && ($entry != ""))
|
||||||
$parent_author_signature = base64_decode($entry);
|
$parent_author_signature = base64_decode($entry);
|
||||||
elseif (!in_array($fieldname, array("author_signature", "parent_author_signature", "target_author_signature"))) {
|
elseif (!in_array($fieldname, array("author_signature", "parent_author_signature", "target_author_signature"))) {
|
||||||
if ($signed_data != "") {
|
if ($signed_data != "") {
|
||||||
|
@ -624,7 +624,7 @@ class Diaspora {
|
||||||
|
|
||||||
$signed_data .= $entry;
|
$signed_data .= $entry;
|
||||||
}
|
}
|
||||||
if (!in_array($fieldname, array("parent_author_signature", "target_author_signature")) OR
|
if (!in_array($fieldname, array("parent_author_signature", "target_author_signature")) ||
|
||||||
($orig_type == "relayable_retraction"))
|
($orig_type == "relayable_retraction"))
|
||||||
xml::copy($entry, $fields, $fieldname);
|
xml::copy($entry, $fields, $fieldname);
|
||||||
}
|
}
|
||||||
|
@ -714,13 +714,13 @@ class Diaspora {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$person OR $update) {
|
if (!$person || $update) {
|
||||||
logger("create or refresh", LOGGER_DEBUG);
|
logger("create or refresh", LOGGER_DEBUG);
|
||||||
$r = probe_url($handle, PROBE_DIASPORA);
|
$r = probe_url($handle, PROBE_DIASPORA);
|
||||||
|
|
||||||
// Note that Friendica contacts will return a "Diaspora person"
|
// Note that Friendica contacts will return a "Diaspora person"
|
||||||
// if Diaspora connectivity is enabled on their server
|
// if Diaspora connectivity is enabled on their server
|
||||||
if ($r AND ($r["network"] === NETWORK_DIASPORA)) {
|
if ($r && ($r["network"] === NETWORK_DIASPORA)) {
|
||||||
self::add_fcontact($r, $update);
|
self::add_fcontact($r, $update);
|
||||||
$person = $r;
|
$person = $r;
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,7 @@ class Diaspora {
|
||||||
// Fetch the author - for the old and the new Diaspora version
|
// Fetch the author - for the old and the new Diaspora version
|
||||||
if ($source_xml->post->status_message->diaspora_handle)
|
if ($source_xml->post->status_message->diaspora_handle)
|
||||||
$author = (string)$source_xml->post->status_message->diaspora_handle;
|
$author = (string)$source_xml->post->status_message->diaspora_handle;
|
||||||
elseif ($source_xml->author AND ($source_xml->getName() == "status_message"))
|
elseif ($source_xml->author && ($source_xml->getName() == "status_message"))
|
||||||
$author = (string)$source_xml->author;
|
$author = (string)$source_xml->author;
|
||||||
|
|
||||||
// If this isn't a "status_message" then quit
|
// If this isn't a "status_message" then quit
|
||||||
|
@ -1403,7 +1403,7 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = self::message_exists($importer["uid"], $guid);
|
$message_id = self::message_exists($importer["uid"], $guid);
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
return $message_id;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
|
$parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
|
||||||
|
@ -1462,12 +1462,16 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = item_store($datarray);
|
$message_id = item_store($datarray);
|
||||||
|
|
||||||
|
if ($message_id <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we are the origin of the parent we store the original data and notify our followers
|
// If we are the origin of the parent we store the original data and notify our followers
|
||||||
if ($message_id AND $parent_item["origin"]) {
|
if ($message_id && $parent_item["origin"]) {
|
||||||
|
|
||||||
// Formerly we stored the signed text, the signature and the author in different fields.
|
// 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.
|
// We now store the raw data so that we are more flexible.
|
||||||
|
@ -1480,7 +1484,7 @@ class Diaspora {
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message_id;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1631,7 +1635,7 @@ class Diaspora {
|
||||||
}
|
}
|
||||||
if (!$conversation) {
|
if (!$conversation) {
|
||||||
logger("unable to create conversation.");
|
logger("unable to create conversation.");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($messages as $mesg)
|
foreach ($messages as $mesg)
|
||||||
|
@ -1709,7 +1713,7 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = self::message_exists($importer["uid"], $guid);
|
$message_id = self::message_exists($importer["uid"], $guid);
|
||||||
if ($message_id)
|
if ($message_id)
|
||||||
return $message_id;
|
return true;
|
||||||
|
|
||||||
$parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
|
$parent_item = self::parent_item($importer["uid"], $parent_guid, $author, $contact);
|
||||||
if (!$parent_item)
|
if (!$parent_item)
|
||||||
|
@ -1762,11 +1766,16 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = item_store($datarray);
|
$message_id = item_store($datarray);
|
||||||
|
|
||||||
if ($message_id)
|
if ($message_id <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($message_id) {
|
||||||
logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
// If we are the origin of the parent we store the original data and notify our followers
|
// If we are the origin of the parent we store the original data and notify our followers
|
||||||
if ($message_id AND $parent_item["origin"]) {
|
if ($message_id && $parent_item["origin"]) {
|
||||||
|
|
||||||
// Formerly we stored the signed text, the signature and the author in different fields.
|
// 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.
|
// We now store the raw data so that we are more flexible.
|
||||||
|
@ -1779,7 +1788,7 @@ class Diaspora {
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
|
proc_run(PRIORITY_HIGH, "include/notifier.php", "comment-import", $message_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message_id;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2115,7 +2124,7 @@ class Diaspora {
|
||||||
// perhaps we were already sharing with this person. Now they're sharing with us.
|
// perhaps we were already sharing with this person. Now they're sharing with us.
|
||||||
// That makes us friends.
|
// That makes us friends.
|
||||||
if ($contact) {
|
if ($contact) {
|
||||||
if ($following AND $sharing) {
|
if ($following && $sharing) {
|
||||||
logger("Author ".$author." (Contact ".$contact["id"].") wants to have a bidirectional conection.", LOGGER_DEBUG);
|
logger("Author ".$author." (Contact ".$contact["id"].") wants to have a bidirectional conection.", LOGGER_DEBUG);
|
||||||
self::receive_request_make_friend($importer, $contact);
|
self::receive_request_make_friend($importer, $contact);
|
||||||
|
|
||||||
|
@ -2138,17 +2147,17 @@ class Diaspora {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$following AND $sharing AND in_array($importer["page-flags"], array(PAGE_SOAPBOX, PAGE_NORMAL))) {
|
if (!$following && $sharing && in_array($importer["page-flags"], array(PAGE_SOAPBOX, PAGE_NORMAL))) {
|
||||||
logger("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
|
logger("Author ".$author." wants to share with us - but doesn't want to listen. Request is ignored.", LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
} elseif (!$following AND !$sharing) {
|
} elseif (!$following && !$sharing) {
|
||||||
logger("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
|
logger("Author ".$author." doesn't want anything - and we don't know the author. Request is ignored.", LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
} elseif (!$following AND $sharing) {
|
} elseif (!$following && $sharing) {
|
||||||
logger("Author ".$author." wants to share with us.", LOGGER_DEBUG);
|
logger("Author ".$author." wants to share with us.", LOGGER_DEBUG);
|
||||||
} elseif ($following AND $sharing) {
|
} elseif ($following && $sharing) {
|
||||||
logger("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
|
logger("Author ".$author." wants to have a bidirectional conection.", LOGGER_DEBUG);
|
||||||
} elseif ($following AND !$sharing) {
|
} elseif ($following && !$sharing) {
|
||||||
logger("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
|
logger("Author ".$author." wants to listen to us.", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2226,9 +2235,9 @@ class Diaspora {
|
||||||
// but if our page-type is PAGE_COMMUNITY or PAGE_SOAPBOX
|
// but if our page-type is PAGE_COMMUNITY or PAGE_SOAPBOX
|
||||||
// we are going to change the relationship and make them a follower.
|
// we are going to change the relationship and make them a follower.
|
||||||
|
|
||||||
if (($importer["page-flags"] == PAGE_FREELOVE) AND $sharing AND $following)
|
if (($importer["page-flags"] == PAGE_FREELOVE) && $sharing && $following)
|
||||||
$new_relation = CONTACT_IS_FRIEND;
|
$new_relation = CONTACT_IS_FRIEND;
|
||||||
elseif (($importer["page-flags"] == PAGE_FREELOVE) AND $sharing)
|
elseif (($importer["page-flags"] == PAGE_FREELOVE) && $sharing)
|
||||||
$new_relation = CONTACT_IS_SHARING;
|
$new_relation = CONTACT_IS_SHARING;
|
||||||
else
|
else
|
||||||
$new_relation = CONTACT_IS_FOLLOWER;
|
$new_relation = CONTACT_IS_FOLLOWER;
|
||||||
|
@ -2356,7 +2365,7 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = self::message_exists($importer["uid"], $guid);
|
$message_id = self::message_exists($importer["uid"], $guid);
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
return $message_id;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$original_item = self::original_item($root_guid, $root_author, $author);
|
$original_item = self::original_item($root_guid, $root_author, $author);
|
||||||
|
@ -2407,9 +2416,10 @@ class Diaspora {
|
||||||
|
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
logger("Stored reshare ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2450,7 +2460,7 @@ class Diaspora {
|
||||||
intval($r[0]["parent"]));
|
intval($r[0]["parent"]));
|
||||||
|
|
||||||
// Only delete it if the parent author really fits
|
// Only delete it if the parent author really fits
|
||||||
if (!link_compare($p[0]["author-link"], $contact["url"]) AND !link_compare($r[0]["author-link"], $contact["url"])) {
|
if (!link_compare($p[0]["author-link"], $contact["url"]) && !link_compare($r[0]["author-link"], $contact["url"])) {
|
||||||
logger("Thread author ".$p[0]["author-link"]." and item author ".$r[0]["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
|
logger("Thread author ".$p[0]["author-link"]." and item author ".$r[0]["author-link"]." don't fit to expected contact ".$contact["url"], LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2487,7 +2497,7 @@ class Diaspora {
|
||||||
$target_type = notags(unxmlify($data->target_type));
|
$target_type = notags(unxmlify($data->target_type));
|
||||||
|
|
||||||
$contact = self::contact_by_handle($importer["uid"], $sender);
|
$contact = self::contact_by_handle($importer["uid"], $sender);
|
||||||
if (!$contact AND (in_array($target_type, array("Contact", "Person")))) {
|
if (!$contact && (in_array($target_type, array("Contact", "Person")))) {
|
||||||
logger("cannot find contact for sender: ".$sender." and user ".$importer["uid"]);
|
logger("cannot find contact for sender: ".$sender." and user ".$importer["uid"]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2540,7 +2550,7 @@ class Diaspora {
|
||||||
|
|
||||||
$message_id = self::message_exists($importer["uid"], $guid);
|
$message_id = self::message_exists($importer["uid"], $guid);
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
return $message_id;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$address = array();
|
$address = array();
|
||||||
|
@ -2615,7 +2625,7 @@ class Diaspora {
|
||||||
$datarray["location"] = $address["address"];
|
$datarray["location"] = $address["address"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($address["lat"]) AND isset($address["lng"])) {
|
if (isset($address["lat"]) && isset($address["lng"])) {
|
||||||
$datarray["coord"] = $address["lat"]." ".$address["lng"];
|
$datarray["coord"] = $address["lat"]." ".$address["lng"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2624,9 +2634,10 @@ class Diaspora {
|
||||||
|
|
||||||
if ($message_id) {
|
if ($message_id) {
|
||||||
logger("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
logger("Stored item ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $message_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************************** *
|
/* ************************************************************************************** *
|
||||||
|
@ -2927,7 +2938,7 @@ class Diaspora {
|
||||||
// The message could not be delivered. We mark the contact as "dead"
|
// The message could not be delivered. We mark the contact as "dead"
|
||||||
mark_for_death($contact);
|
mark_for_death($contact);
|
||||||
}
|
}
|
||||||
} elseif (($return_code >= 200) AND ($return_code <= 299)) {
|
} elseif (($return_code >= 200) && ($return_code <= 299)) {
|
||||||
// We successfully delivered a message, the contact is alive
|
// We successfully delivered a message, the contact is alive
|
||||||
unmark_for_death($contact);
|
unmark_for_death($contact);
|
||||||
}
|
}
|
||||||
|
@ -3037,7 +3048,7 @@ class Diaspora {
|
||||||
|
|
||||||
// Skip if it isn't a pure repeated messages
|
// Skip if it isn't a pure repeated messages
|
||||||
// Does it start with a share?
|
// Does it start with a share?
|
||||||
if ((strpos($body, "[share") > 0) AND $complete)
|
if ((strpos($body, "[share") > 0) && $complete)
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
// Does it end with a share?
|
// Does it end with a share?
|
||||||
|
@ -3085,7 +3096,7 @@ class Diaspora {
|
||||||
$ret= array();
|
$ret= array();
|
||||||
|
|
||||||
$ret["root_handle"] = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
|
$ret["root_handle"] = preg_replace("=https?://(.*)/u/(.*)=ism", "$2@$1", $profile);
|
||||||
if (($ret["root_handle"] == $profile) OR ($ret["root_handle"] == ""))
|
if (($ret["root_handle"] == $profile) || ($ret["root_handle"] == ""))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
$link = "";
|
$link = "";
|
||||||
|
@ -3098,7 +3109,7 @@ class Diaspora {
|
||||||
$link = $matches[1];
|
$link = $matches[1];
|
||||||
|
|
||||||
$ret["root_guid"] = preg_replace("=https?://(.*)/posts/(.*)=ism", "$2", $link);
|
$ret["root_guid"] = preg_replace("=https?://(.*)/posts/(.*)=ism", "$2", $link);
|
||||||
if (($ret["root_guid"] == $link) OR (trim($ret["root_guid"]) == ""))
|
if (($ret["root_guid"] == $link) || (trim($ret["root_guid"]) == ""))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
return($ret);
|
return($ret);
|
||||||
|
@ -3158,7 +3169,7 @@ class Diaspora {
|
||||||
if ($event['start']) {
|
if ($event['start']) {
|
||||||
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
|
||||||
}
|
}
|
||||||
if ($event['finish'] AND !$event['nofinish']) {
|
if ($event['finish'] && !$event['nofinish']) {
|
||||||
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
|
||||||
}
|
}
|
||||||
if ($event['summary']) {
|
if ($event['summary']) {
|
||||||
|
@ -3204,7 +3215,7 @@ class Diaspora {
|
||||||
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
|
||||||
|
|
||||||
// Detect a share element and do a reshare
|
// Detect a share element and do a reshare
|
||||||
if (!$item['private'] AND ($ret = self::is_reshare($item["body"]))) {
|
if (!$item['private'] && ($ret = self::is_reshare($item["body"]))) {
|
||||||
$message = array("root_diaspora_id" => $ret["root_handle"],
|
$message = array("root_diaspora_id" => $ret["root_handle"],
|
||||||
"root_guid" => $ret["root_guid"],
|
"root_guid" => $ret["root_guid"],
|
||||||
"guid" => $item["guid"],
|
"guid" => $item["guid"],
|
||||||
|
@ -3254,7 +3265,7 @@ class Diaspora {
|
||||||
"provider_display_name" => $item["app"]);
|
"provider_display_name" => $item["app"]);
|
||||||
|
|
||||||
// Diaspora rejects messages when they contain a location without "lat" or "lng"
|
// Diaspora rejects messages when they contain a location without "lat" or "lng"
|
||||||
if (!isset($location["lat"]) OR !isset($location["lng"])) {
|
if (!isset($location["lat"]) || !isset($location["lng"])) {
|
||||||
unset($message["location"]);
|
unset($message["location"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3529,7 +3540,7 @@ class Diaspora {
|
||||||
|
|
||||||
// Old way - is used by the internal Friendica functions
|
// Old way - is used by the internal Friendica functions
|
||||||
/// @todo Change all signatur storing functions to the new format
|
/// @todo Change all signatur storing functions to the new format
|
||||||
if ($signature['signed_text'] AND $signature['signature'] AND $signature['signer'])
|
if ($signature['signed_text'] && $signature['signature'] && $signature['signer'])
|
||||||
$message = self::message_from_signature($item, $signature);
|
$message = self::message_from_signature($item, $signature);
|
||||||
else {// New way
|
else {// New way
|
||||||
$msg = json_decode($signature['signed_text'], true);
|
$msg = json_decode($signature['signed_text'], true);
|
||||||
|
@ -3581,7 +3592,7 @@ class Diaspora {
|
||||||
$target_type = "StatusMessage";
|
$target_type = "StatusMessage";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($relay AND ($item["uri"] !== $item["parent-uri"]))
|
if ($relay && ($item["uri"] !== $item["parent-uri"]))
|
||||||
$signature = "parent_author_signature";
|
$signature = "parent_author_signature";
|
||||||
else
|
else
|
||||||
$signature = "target_author_signature";
|
$signature = "target_author_signature";
|
||||||
|
@ -3761,7 +3772,7 @@ class Diaspora {
|
||||||
public static function store_like_signature($contact, $post_id) {
|
public static function store_like_signature($contact, $post_id) {
|
||||||
|
|
||||||
// Is the contact the owner? Then fetch the private key
|
// Is the contact the owner? Then fetch the private key
|
||||||
if (!$contact['self'] OR ($contact['uid'] == 0)) {
|
if (!$contact['self'] || ($contact['uid'] == 0)) {
|
||||||
logger("No owner post, so not storing signature", LOGGER_DEBUG);
|
logger("No owner post, so not storing signature", LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,12 @@ function discover_poco_run(&$argv, &$argc) {
|
||||||
logger($result, LOGGER_DEBUG);
|
logger($result, LOGGER_DEBUG);
|
||||||
} elseif ($mode == 3) {
|
} elseif ($mode == 3) {
|
||||||
update_suggestions();
|
update_suggestions();
|
||||||
} elseif (($mode == 2) AND get_config('system','poco_completion')) {
|
} elseif (($mode == 2) && get_config('system','poco_completion')) {
|
||||||
discover_users();
|
discover_users();
|
||||||
} elseif (($mode == 1) AND ($search != "") and get_config('system','poco_local_search')) {
|
} elseif (($mode == 1) && ($search != "") && get_config('system','poco_local_search')) {
|
||||||
discover_directory($search);
|
discover_directory($search);
|
||||||
gs_search_user($search);
|
gs_search_user($search);
|
||||||
} elseif (($mode == 0) AND ($search == "") and (get_config('system','poco_discovery') > 0)) {
|
} elseif (($mode == 0) && ($search == "") && (get_config('system','poco_discovery') > 0)) {
|
||||||
// Query Friendica and Hubzilla servers for their users
|
// Query Friendica and Hubzilla servers for their users
|
||||||
poco_discover();
|
poco_discover();
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ function discover_users() {
|
||||||
$server_url = $user["server_url"];
|
$server_url = $user["server_url"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($server_url == "") AND ($user["network"] == NETWORK_FEED)) OR $force_update OR poco_check_server($server_url, $user["network"])) {
|
if ((($server_url == "") && ($user["network"] == NETWORK_FEED)) || $force_update || poco_check_server($server_url, $user["network"])) {
|
||||||
logger('Check profile '.$user["url"]);
|
logger('Check profile '.$user["url"]);
|
||||||
proc_run(PRIORITY_LOW, "include/discover_poco.php", "check_profile", base64_encode($user["url"]));
|
proc_run(PRIORITY_LOW, "include/discover_poco.php", "check_profile", base64_encode($user["url"]));
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ function discover_directory($search) {
|
||||||
if (dbm::is_result($exists)) {
|
if (dbm::is_result($exists)) {
|
||||||
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
|
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
|
||||||
|
|
||||||
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) AND
|
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) &&
|
||||||
($exists[0]["updated"] < $exists[0]["last_failure"])) {
|
($exists[0]["updated"] < $exists[0]["last_failure"])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ function email_get_part($mbox,$uid,$p,$partno, $subtype) {
|
||||||
if ($p->parameters)
|
if ($p->parameters)
|
||||||
foreach ($p->parameters as $x)
|
foreach ($p->parameters as $x)
|
||||||
$params[strtolower($x->attribute)] = $x->value;
|
$params[strtolower($x->attribute)] = $x->value;
|
||||||
if (isset($p->dparameters) and $p->dparameters)
|
if (isset($p->dparameters) && $p->dparameters)
|
||||||
foreach ($p->dparameters as $x)
|
foreach ($p->dparameters as $x)
|
||||||
$params[strtolower($x->attribute)] = $x->value;
|
$params[strtolower($x->attribute)] = $x->value;
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ function email_get_part($mbox,$uid,$p,$partno, $subtype) {
|
||||||
// Any part with a filename is an attachment,
|
// Any part with a filename is an attachment,
|
||||||
// so an attached text file (type 0) is not mistaken as the message.
|
// so an attached text file (type 0) is not mistaken as the message.
|
||||||
|
|
||||||
if ((isset($params['filename']) and $params['filename']) || (isset($params['name']) and $params['name'])) {
|
if ((isset($params['filename']) && $params['filename']) || (isset($params['name']) && $params['name'])) {
|
||||||
// filename may be given as 'Filename' or 'Name' or both
|
// filename may be given as 'Filename' or 'Name' or both
|
||||||
$filename = ($params['filename'])? $params['filename'] : $params['name'];
|
$filename = ($params['filename'])? $params['filename'] : $params['name'];
|
||||||
// filename may be encoded, so see imap_mime_header_decode()
|
// filename may be encoded, so see imap_mime_header_decode()
|
||||||
|
@ -191,7 +191,7 @@ function email_get_part($mbox,$uid,$p,$partno, $subtype) {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// SUBPART RECURSION
|
// SUBPART RECURSION
|
||||||
if (isset($p->parts) and $p->parts) {
|
if (isset($p->parts) && $p->parts) {
|
||||||
$x = "";
|
$x = "";
|
||||||
foreach ($p->parts as $partno0=>$p2) {
|
foreach ($p->parts as $partno0=>$p2) {
|
||||||
$x .= email_get_part($mbox,$uid,$p2,$partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
|
$x .= email_get_part($mbox,$uid,$p2,$partno . '.' . ($partno0+1), $subtype); // 1.2, 1.2.1, etc.
|
||||||
|
|
|
@ -99,7 +99,7 @@ function notification($params) {
|
||||||
intval($parent_id),
|
intval($parent_id),
|
||||||
intval($params['uid'])
|
intval($params['uid'])
|
||||||
);
|
);
|
||||||
if ($p AND count($p) AND ($p[0]["ignored"])) {
|
if ($p && count($p) && ($p[0]["ignored"])) {
|
||||||
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
logger("Thread ".$parent_id." will be ignored", LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ function notification($params) {
|
||||||
dbesc($params['link']),
|
dbesc($params['link']),
|
||||||
intval($params['uid'])
|
intval($params['uid'])
|
||||||
);
|
);
|
||||||
if ($p and count($p)) {
|
if ($p && count($p)) {
|
||||||
pop_lang();
|
pop_lang();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ function notification($params) {
|
||||||
|
|
||||||
logger('sending notification email');
|
logger('sending notification email');
|
||||||
|
|
||||||
if (isset($params['parent']) AND (intval($params['parent']) != 0)) {
|
if (isset($params['parent']) && (intval($params['parent']) != 0)) {
|
||||||
$id_for_parent = $params['parent']."@".$hostname;
|
$id_for_parent = $params['parent']."@".$hostname;
|
||||||
|
|
||||||
// Is this the first email notification for this parent item and user?
|
// Is this the first email notification for this parent item and user?
|
||||||
|
@ -676,7 +676,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
// Check for invalid profile urls. 13 should be the shortest possible profile length:
|
// Check for invalid profile urls. 13 should be the shortest possible profile length:
|
||||||
// http://a.bc/d
|
// http://a.bc/d
|
||||||
// Additionally check for invalid urls that would return the normalised value "http:"
|
// Additionally check for invalid urls that would return the normalised value "http:"
|
||||||
if ((strlen($profile) >= 13) AND (normalise_link($profile) != "http:")) {
|
if ((strlen($profile) >= 13) && (normalise_link($profile) != "http:")) {
|
||||||
if (!in_array($profile, $profiles2))
|
if (!in_array($profile, $profiles2))
|
||||||
$profiles2[] = $profile;
|
$profiles2[] = $profile;
|
||||||
|
|
||||||
|
@ -760,11 +760,11 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
$tagged = false;
|
$tagged = false;
|
||||||
|
|
||||||
foreach ($profiles AS $profile) {
|
foreach ($profiles AS $profile) {
|
||||||
if (strpos($item[0]["tag"], "=".$profile."]") OR strpos($item[0]["body"], "=".$profile."]"))
|
if (strpos($item[0]["tag"], "=".$profile."]") || strpos($item[0]["body"], "=".$profile."]"))
|
||||||
$tagged = true;
|
$tagged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item[0]["mention"] OR $tagged OR ($defaulttype == NOTIFY_TAGSELF)) {
|
if ($item[0]["mention"] || $tagged || ($defaulttype == NOTIFY_TAGSELF)) {
|
||||||
$params["type"] = NOTIFY_TAGSELF;
|
$params["type"] = NOTIFY_TAGSELF;
|
||||||
$params["verb"] = ACTIVITY_TAG;
|
$params["verb"] = ACTIVITY_TAG;
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
|
||||||
LIMIT 1",
|
LIMIT 1",
|
||||||
intval($item[0]["parent"]), intval($uid));
|
intval($item[0]["parent"]), intval($uid));
|
||||||
|
|
||||||
if ($parent AND !isset($params["type"])) {
|
if ($parent && !isset($params["type"])) {
|
||||||
$params["type"] = NOTIFY_COMMENT;
|
$params["type"] = NOTIFY_COMMENT;
|
||||||
$params["verb"] = ACTIVITY_POST;
|
$params["verb"] = ACTIVITY_POST;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,10 @@ function update_contact($id) {
|
||||||
|
|
||||||
// make sure to not overwrite existing values with blank entries
|
// make sure to not overwrite existing values with blank entries
|
||||||
foreach ($ret AS $key => $val) {
|
foreach ($ret AS $key => $val) {
|
||||||
if (isset($r[0][$key]) AND ($r[0][$key] != "") AND ($val == ""))
|
if (isset($r[0][$key]) && ($r[0][$key] != "") && ($val == ""))
|
||||||
$ret[$key] = $r[0][$key];
|
$ret[$key] = $r[0][$key];
|
||||||
|
|
||||||
if (isset($r[0][$key]) AND ($ret[$key] != $r[0][$key]))
|
if (isset($r[0][$key]) && ($ret[$key] != $r[0][$key]))
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ function gprobe_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
// Check for accessibility and do a poco discovery
|
// Check for accessibility and do a poco discovery
|
||||||
if (poco_last_updated($r[0]['url'], true) AND ($r[0]["network"] == NETWORK_DFRN))
|
if (poco_last_updated($r[0]['url'], true) && ($r[0]["network"] == NETWORK_DFRN))
|
||||||
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
|
poco_load(0,0,$r[0]['id'], str_replace('/profile/','/poco/',$r[0]['url']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ function group_add($uid,$name) {
|
||||||
intval($uid),
|
intval($uid),
|
||||||
dbesc($name)
|
dbesc($name)
|
||||||
);
|
);
|
||||||
notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ function expand_groups($a,$check_dead = false, $use_gcontact = false) {
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r))
|
||||||
foreach ($r as $rr)
|
foreach ($r as $rr)
|
||||||
$ret[] = $rr['contact-id'];
|
$ret[] = $rr['contact-id'];
|
||||||
if ($check_dead AND !$use_gcontact) {
|
if ($check_dead && !$use_gcontact) {
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
$ret = prune_deadguys($ret);
|
$ret = prune_deadguys($ret);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ function node2bbcodesub(&$doc, $oldnode, $attributes, $startbb, $endbb)
|
||||||
|
|
||||||
if (strpos('*'.$startbb, '$1') > 0) {
|
if (strpos('*'.$startbb, '$1') > 0) {
|
||||||
|
|
||||||
if ($replace and (@$attr[$attribute] != '')) {
|
if ($replace && (@$attr[$attribute] != '')) {
|
||||||
|
|
||||||
$startbb = preg_replace($value, $startbb, $attr[$attribute], -1, $count);
|
$startbb = preg_replace($value, $startbb, $attr[$attribute], -1, $count);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ function breaklines($line, $level, $wraplength = 75)
|
||||||
if ($pos == 0)
|
if ($pos == 0)
|
||||||
$pos = strpos($line, ' ');
|
$pos = strpos($line, ' ');
|
||||||
|
|
||||||
if (($pos > 0) and strlen($line) > $wraplen) {
|
if (($pos > 0) && strlen($line) > $wraplen) {
|
||||||
$newline = trim(substr($line, 0, $pos));
|
$newline = trim(substr($line, 0, $pos));
|
||||||
if ($level > 0)
|
if ($level > 0)
|
||||||
$newline = str_repeat(">", $level).' '.$newline;
|
$newline = str_repeat(">", $level).' '.$newline;
|
||||||
|
@ -32,7 +32,7 @@ function breaklines($line, $level, $wraplength = 75)
|
||||||
$line = substr($line, $pos+1);
|
$line = substr($line, $pos+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while ((strlen($line) > $wraplen) and !($oldline == $line));
|
} while ((strlen($line) > $wraplen) && !($oldline == $line));
|
||||||
|
|
||||||
if ($level > 0)
|
if ($level > 0)
|
||||||
$line = str_repeat(">", $level).' '.$line;
|
$line = str_repeat(">", $level).' '.$line;
|
||||||
|
@ -70,7 +70,7 @@ function quotelevel($message, $wraplength = 75)
|
||||||
$line = substr($line, 0, $pos).substr($line, $pos+8);
|
$line = substr($line, 0, $pos).substr($line, $pos+8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$startquote or ($line != ''))
|
if (!$startquote || ($line != ''))
|
||||||
$newlines[] = breaklines($line, $currlevel, $wraplength);
|
$newlines[] = breaklines($line, $currlevel, $wraplength);
|
||||||
}
|
}
|
||||||
return(implode($newlines, "\n"));
|
return(implode($newlines, "\n"));
|
||||||
|
@ -92,13 +92,13 @@ function collecturls($message) {
|
||||||
if (strpos($treffer[1], $listitem) !== false)
|
if (strpos($treffer[1], $listitem) !== false)
|
||||||
$ignore = true;
|
$ignore = true;
|
||||||
|
|
||||||
if ((strpos($treffer[1], "//twitter.com/") !== false) and (strpos($treffer[1], "/status/") !== false))
|
if ((strpos($treffer[1], "//twitter.com/") !== false) && (strpos($treffer[1], "/status/") !== false))
|
||||||
$ignore = false;
|
$ignore = false;
|
||||||
|
|
||||||
if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/posts") !== false))
|
if ((strpos($treffer[1], "//plus.google.com/") !== false) && (strpos($treffer[1], "/posts") !== false))
|
||||||
$ignore = false;
|
$ignore = false;
|
||||||
|
|
||||||
if ((strpos($treffer[1], "//plus.google.com/") !== false) and (strpos($treffer[1], "/photos") !== false))
|
if ((strpos($treffer[1], "//plus.google.com/") !== false) && (strpos($treffer[1], "/photos") !== false))
|
||||||
$ignore = false;
|
$ignore = false;
|
||||||
|
|
||||||
if (!$ignore)
|
if (!$ignore)
|
||||||
|
@ -212,7 +212,7 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
||||||
|
|
||||||
$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
|
$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
if (!$compact AND ($message != "")) {
|
if (!$compact && ($message != "")) {
|
||||||
$counter = 1;
|
$counter = 1;
|
||||||
foreach ($urls as $id=>$url)
|
foreach ($urls as $id=>$url)
|
||||||
if ($url != "")
|
if ($url != "")
|
||||||
|
|
|
@ -152,7 +152,9 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
|
||||||
|
|
||||||
if ($profile) {
|
if ($profile) {
|
||||||
$profile_int = intval($profile);
|
$profile_int = intval($profile);
|
||||||
$r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
|
$r = q("SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` AS `contact_photo`,
|
||||||
|
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
|
||||||
|
`profile`.`uid` AS `profile_uid`, `profile`.*,
|
||||||
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
|
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
|
||||||
FROM `profile`
|
FROM `profile`
|
||||||
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
|
INNER JOIN `contact` on `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
|
||||||
|
@ -163,7 +165,9 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!dbm::is_result($r)) {
|
if (!dbm::is_result($r)) {
|
||||||
$r = q("SELECT `contact`.`id` AS `contact_id`, `profile`.`uid` AS `profile_uid`, `profile`.*,
|
$r = q("SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
|
||||||
|
`contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
|
||||||
|
`profile`.`uid` AS `profile_uid`, `profile`.*,
|
||||||
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
|
`contact`.`avatar-date` AS picdate, `contact`.`addr`, `user`.*
|
||||||
FROM `profile`
|
FROM `profile`
|
||||||
INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
|
INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` AND `contact`.`self`
|
||||||
|
@ -213,7 +217,7 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
|
|
||||||
$profile['picdate'] = urlencode($profile['picdate']);
|
$profile['picdate'] = urlencode($profile['picdate']);
|
||||||
|
|
||||||
if (($profile['network'] != "") AND ($profile['network'] != NETWORK_DFRN)) {
|
if (($profile['network'] != "") && ($profile['network'] != NETWORK_DFRN)) {
|
||||||
$profile['network_name'] = format_network_name($profile['network'], $profile['url']);
|
$profile['network_name'] = format_network_name($profile['network'], $profile['url']);
|
||||||
} else {
|
} else {
|
||||||
$profile['network_name'] = "";
|
$profile['network_name'] = "";
|
||||||
|
@ -236,7 +240,7 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the local user already connected to that user?
|
// Is the local user already connected to that user?
|
||||||
if ($connect AND local_user()) {
|
if ($connect && local_user()) {
|
||||||
if (isset($profile["url"])) {
|
if (isset($profile["url"])) {
|
||||||
$profile_url = normalise_link($profile["url"]);
|
$profile_url = normalise_link($profile["url"]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -250,19 +254,19 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
$connect = false;
|
$connect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($connect AND ($profile['network'] != NETWORK_DFRN) AND !isset($profile['remoteconnect']))
|
if ($connect && ($profile['network'] != NETWORK_DFRN) && !isset($profile['remoteconnect']))
|
||||||
$connect = false;
|
$connect = false;
|
||||||
|
|
||||||
$remoteconnect = NULL;
|
$remoteconnect = NULL;
|
||||||
if (isset($profile['remoteconnect']))
|
if (isset($profile['remoteconnect']))
|
||||||
$remoteconnect = $profile['remoteconnect'];
|
$remoteconnect = $profile['remoteconnect'];
|
||||||
|
|
||||||
if ($connect AND ($profile['network'] == NETWORK_DFRN) AND !isset($remoteconnect))
|
if ($connect && ($profile['network'] == NETWORK_DFRN) && !isset($remoteconnect))
|
||||||
$subscribe_feed = t("Atom feed");
|
$subscribe_feed = t("Atom feed");
|
||||||
else
|
else
|
||||||
$subscribe_feed = false;
|
$subscribe_feed = false;
|
||||||
|
|
||||||
if (remote_user() OR (get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))) {
|
if (remote_user() || (get_my_url() && $profile['unkmail'] && ($profile['uid'] != local_user()))) {
|
||||||
$wallmessage = t('Message');
|
$wallmessage = t('Message');
|
||||||
$wallmessage_link = "wallmessage/".$profile["nickname"];
|
$wallmessage_link = "wallmessage/".$profile["nickname"];
|
||||||
|
|
||||||
|
@ -365,9 +369,9 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
'fullname' => $profile['name'],
|
'fullname' => $profile['name'],
|
||||||
'firstname' => $firstname,
|
'firstname' => $firstname,
|
||||||
'lastname' => $lastname,
|
'lastname' => $lastname,
|
||||||
'photo300' => App::get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
|
'photo300' => $profile['contact_photo'],
|
||||||
'photo100' => App::get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg',
|
'photo100' => $profile['contact_thumb'],
|
||||||
'photo50' => App::get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg',
|
'photo50' => $profile['contact_micro'],
|
||||||
);
|
);
|
||||||
else
|
else
|
||||||
$diaspora = false;
|
$diaspora = false;
|
||||||
|
@ -375,7 +379,7 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
if (!$block) {
|
if (!$block) {
|
||||||
$contact_block = contact_block();
|
$contact_block = contact_block();
|
||||||
|
|
||||||
if (is_array($a->profile) AND !$a->profile['hide-friends']) {
|
if (is_array($a->profile) && !$a->profile['hide-friends']) {
|
||||||
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
|
||||||
intval($a->profile['uid']));
|
intval($a->profile['uid']));
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r))
|
||||||
|
@ -410,9 +414,9 @@ function profile_sidebar($profile, $block = 0) {
|
||||||
else
|
else
|
||||||
$p["address"] = bbcode($p["location"]);
|
$p["address"] = bbcode($p["location"]);
|
||||||
|
|
||||||
if (isset($p["photo"]))
|
if (isset($p["photo"])) {
|
||||||
$p["photo"] = proxy_url($p["photo"], false, PROXY_SIZE_SMALL);
|
$p["photo"] = proxy_url($p["photo"], false, PROXY_SIZE_SMALL);
|
||||||
|
}
|
||||||
if ($a->theme['template_engine'] === 'internal')
|
if ($a->theme['template_engine'] === 'internal')
|
||||||
$location = template_escape($location);
|
$location = template_escape($location);
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ function title_is_body($title, $body) {
|
||||||
$body = substr($body, 0, strlen($title));
|
$body = substr($body, 0, strlen($title));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($title != $body) and (substr($title, -3) == "...")) {
|
if (($title != $body) && (substr($title, -3) == "...")) {
|
||||||
$pos = strrpos($title, "...");
|
$pos = strrpos($title, "...");
|
||||||
if ($pos > 0) {
|
if ($pos > 0) {
|
||||||
$title = substr($title, 0, $pos);
|
$title = substr($title, 0, $pos);
|
||||||
|
@ -159,16 +159,16 @@ function add_page_info_data($data) {
|
||||||
|
|
||||||
// It maybe is a rich content, but if it does have everything that a link has,
|
// It maybe is a rich content, but if it does have everything that a link has,
|
||||||
// then treat it that way
|
// then treat it that way
|
||||||
if (($data["type"] == "rich") AND is_string($data["title"]) AND
|
if (($data["type"] == "rich") && is_string($data["title"]) &&
|
||||||
is_string($data["text"]) AND (sizeof($data["images"]) > 0)) {
|
is_string($data["text"]) && (sizeof($data["images"]) > 0)) {
|
||||||
$data["type"] = "link";
|
$data["type"] = "link";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($data["type"] != "link") AND ($data["type"] != "video") AND ($data["type"] != "photo")) OR ($data["title"] == $data["url"])) {
|
if ((($data["type"] != "link") && ($data["type"] != "video") && ($data["type"] != "photo")) || ($data["title"] == $data["url"])) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($no_photos AND ($data["type"] == "photo")) {
|
if ($no_photos && ($data["type"] == "photo")) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ function add_page_info_data($data) {
|
||||||
$preview = str_replace(array("[", "]"), array("[", "]"), htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
|
$preview = str_replace(array("[", "]"), array("[", "]"), 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
|
// 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)
|
// But only, if the picture isn't higher than large (To prevent huge posts)
|
||||||
if (($data["images"][0]["width"] >= 500) AND ($data["images"][0]["width"] >= $data["images"][0]["height"])) {
|
if (($data["images"][0]["width"] >= 500) && ($data["images"][0]["width"] >= $data["images"][0]["height"])) {
|
||||||
$text .= " image='".$preview."'";
|
$text .= " image='".$preview."'";
|
||||||
} else {
|
} else {
|
||||||
$text .= " preview='".$preview."'";
|
$text .= " preview='".$preview."'";
|
||||||
|
@ -214,7 +214,7 @@ function add_page_info_data($data) {
|
||||||
$text .= "]".$data["text"]."[/attachment]";
|
$text .= "]".$data["text"]."[/attachment]";
|
||||||
|
|
||||||
$hashtags = "";
|
$hashtags = "";
|
||||||
if (isset($data["keywords"]) AND count($data["keywords"])) {
|
if (isset($data["keywords"]) && count($data["keywords"])) {
|
||||||
$hashtags = "\n";
|
$hashtags = "\n";
|
||||||
foreach ($data["keywords"] AS $keyword) {
|
foreach ($data["keywords"] AS $keyword) {
|
||||||
/// @todo make a positive list of allowed characters
|
/// @todo make a positive list of allowed characters
|
||||||
|
@ -237,11 +237,11 @@ function query_page_info($url, $no_photos = false, $photo = "", $keywords = fals
|
||||||
|
|
||||||
logger('fetch page info for ' . $url . ' ' . print_r($data, true), LOGGER_DEBUG);
|
logger('fetch page info for ' . $url . ' ' . print_r($data, true), LOGGER_DEBUG);
|
||||||
|
|
||||||
if (!$keywords AND isset($data["keywords"])) {
|
if (!$keywords && isset($data["keywords"])) {
|
||||||
unset($data["keywords"]);
|
unset($data["keywords"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($keyword_blacklist != "") AND isset($data["keywords"])) {
|
if (($keyword_blacklist != "") && isset($data["keywords"])) {
|
||||||
$list = explode(", ", $keyword_blacklist);
|
$list = explode(", ", $keyword_blacklist);
|
||||||
foreach ($list AS $keyword) {
|
foreach ($list AS $keyword) {
|
||||||
$keyword = trim($keyword);
|
$keyword = trim($keyword);
|
||||||
|
@ -259,7 +259,7 @@ function add_page_keywords($url, $no_photos = false, $photo = "", $keywords = fa
|
||||||
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
|
$data = query_page_info($url, $no_photos, $photo, $keywords, $keyword_blacklist);
|
||||||
|
|
||||||
$tags = "";
|
$tags = "";
|
||||||
if (isset($data["keywords"]) AND count($data["keywords"])) {
|
if (isset($data["keywords"]) && count($data["keywords"])) {
|
||||||
foreach ($data["keywords"] AS $keyword) {
|
foreach ($data["keywords"] AS $keyword) {
|
||||||
$hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
|
$hashtag = str_replace(array(" ", "+", "/", ".", "#", "'"),
|
||||||
array("", "", "", "", "", ""), $keyword);
|
array("", "", "", "", "", ""), $keyword);
|
||||||
|
@ -301,7 +301,7 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert urls without bbcode elements
|
// Convert urls without bbcode elements
|
||||||
if (!$matches AND $texturl) {
|
if (!$matches && $texturl) {
|
||||||
preg_match("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", " ".$body, $matches);
|
preg_match("/([^\]\='".'"'."]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", " ".$body, $matches);
|
||||||
|
|
||||||
// Yeah, a hack. I really hate regular expressions :)
|
// Yeah, a hack. I really hate regular expressions :)
|
||||||
|
@ -315,21 +315,21 @@ function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the link from the body if the link is attached at the end of the post
|
// Remove the link from the body if the link is attached at the end of the post
|
||||||
if (isset($footer) AND (trim($footer) != "") AND (strpos($footer, $matches[1]))) {
|
if (isset($footer) && (trim($footer) != "") && (strpos($footer, $matches[1]))) {
|
||||||
$removedlink = trim(str_replace($matches[1], "", $body));
|
$removedlink = trim(str_replace($matches[1], "", $body));
|
||||||
if (($removedlink == "") OR strstr($body, $removedlink)) {
|
if (($removedlink == "") || strstr($body, $removedlink)) {
|
||||||
$body = $removedlink;
|
$body = $removedlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = str_replace(array('/', '.'), array('\/', '\.'), $matches[1]);
|
$url = str_replace(array('/', '.'), array('\/', '\.'), $matches[1]);
|
||||||
$removedlink = preg_replace("/\[url\=" . $url . "\](.*?)\[\/url\]/ism", '', $body);
|
$removedlink = preg_replace("/\[url\=" . $url . "\](.*?)\[\/url\]/ism", '', $body);
|
||||||
if (($removedlink == "") OR strstr($body, $removedlink)) {
|
if (($removedlink == "") || strstr($body, $removedlink)) {
|
||||||
$body = $removedlink;
|
$body = $removedlink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the page information to the bottom
|
// Add the page information to the bottom
|
||||||
if (isset($footer) AND (trim($footer) != "")) {
|
if (isset($footer) && (trim($footer) != "")) {
|
||||||
$body .= $footer;
|
$body .= $footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,10 +421,10 @@ function store_conversation($arr) {
|
||||||
if (in_array($arr['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
if (in_array($arr['network'], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
|
||||||
$conversation = array('item-uri' => $arr['uri'], 'received' => dbm::date());
|
$conversation = array('item-uri' => $arr['uri'], 'received' => dbm::date());
|
||||||
|
|
||||||
if (isset($arr['parent-uri']) AND ($arr['parent-uri'] != $arr['uri'])) {
|
if (isset($arr['parent-uri']) && ($arr['parent-uri'] != $arr['uri'])) {
|
||||||
$conversation['reply-to-uri'] = $arr['parent-uri'];
|
$conversation['reply-to-uri'] = $arr['parent-uri'];
|
||||||
}
|
}
|
||||||
if (isset($arr['thr-parent']) AND ($arr['thr-parent'] != $arr['uri'])) {
|
if (isset($arr['thr-parent']) && ($arr['thr-parent'] != $arr['uri'])) {
|
||||||
$conversation['reply-to-uri'] = $arr['thr-parent'];
|
$conversation['reply-to-uri'] = $arr['thr-parent'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ function store_conversation($arr) {
|
||||||
unset($old_conv['source']);
|
unset($old_conv['source']);
|
||||||
}
|
}
|
||||||
// Update structure data all the time but the source only when its from a better protocol.
|
// Update structure data all the time but the source only when its from a better protocol.
|
||||||
if (($old_conv['protocol'] < $conversation['protocol']) AND ($old_conv['protocol'] != 0)) {
|
if (($old_conv['protocol'] < $conversation['protocol']) && ($old_conv['protocol'] != 0)) {
|
||||||
unset($conversation['protocol']);
|
unset($conversation['protocol']);
|
||||||
unset($conversation['source']);
|
unset($conversation['source']);
|
||||||
}
|
}
|
||||||
|
@ -503,9 +503,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
|
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$guid_prefix = "";
|
$guid_prefix = "";
|
||||||
} elseif ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "")) {
|
} elseif ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
|
||||||
$arr['guid'] = uri_to_guid($arr['plink']);
|
$arr['guid'] = uri_to_guid($arr['plink']);
|
||||||
} elseif ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "")) {
|
} elseif ((trim($arr['guid']) == "") && (trim($arr['uri']) != "")) {
|
||||||
$arr['guid'] = uri_to_guid($arr['uri']);
|
$arr['guid'] = uri_to_guid($arr['uri']);
|
||||||
} else {
|
} else {
|
||||||
$parsed = parse_url($arr["author-link"]);
|
$parsed = parse_url($arr["author-link"]);
|
||||||
|
@ -653,7 +653,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
$arr['edited'] = datetime_convert();
|
$arr['edited'] = datetime_convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($arr['author-link'] == "") AND ($arr['owner-link'] == "")) {
|
if (($arr['author-link'] == "") && ($arr['owner-link'] == "")) {
|
||||||
logger("Both author-link and owner-link are empty. Called by: " . App::callstack(), LOGGER_DEBUG);
|
logger("Both author-link and owner-link are empty. Called by: " . App::callstack(), LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -832,7 +832,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
|
$self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
|
||||||
logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
|
logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
|
||||||
if ((normalise_link($arr['author-link']) == $self) OR (normalise_link($arr['owner-link']) == $self)) {
|
if ((normalise_link($arr['author-link']) == $self) || (normalise_link($arr['owner-link']) == $self)) {
|
||||||
q("UPDATE `thread` SET `mention` = 1 WHERE `iid` = %d", intval($parent_id));
|
q("UPDATE `thread` SET `mention` = 1 WHERE `iid` = %d", intval($parent_id));
|
||||||
logger("item_store: tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
|
logger("item_store: tagged thread ".$parent_id." as mention for user ".$self, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
@ -1051,7 +1051,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
|
|
||||||
// update the commented timestamp on the parent
|
// update the commented timestamp on the parent
|
||||||
// Only update "commented" if it is really a comment
|
// Only update "commented" if it is really a comment
|
||||||
if (($arr['verb'] == ACTIVITY_POST) OR !get_config("system", "like_no_comment")) {
|
if (($arr['verb'] == ACTIVITY_POST) || !get_config("system", "like_no_comment")) {
|
||||||
q("UPDATE `item` SET `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
|
q("UPDATE `item` SET `commented` = '%s', `changed` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -1089,7 +1089,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
* current post can be deleted if is for a community page and no mention are
|
* current post can be deleted if is for a community page and no mention are
|
||||||
* in it.
|
* in it.
|
||||||
*/
|
*/
|
||||||
if (!$deleted AND !$dontcache) {
|
if (!$deleted && !$dontcache) {
|
||||||
|
|
||||||
$r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
|
$r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
|
||||||
if ((dbm::is_result($r)) && (count($r) == 1)) {
|
if ((dbm::is_result($r)) && (count($r) == 1)) {
|
||||||
|
@ -1156,10 +1156,10 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
*/
|
*/
|
||||||
function item_set_last_item($arr) {
|
function item_set_last_item($arr) {
|
||||||
|
|
||||||
$update = (!$arr['private'] AND (($arr["author-link"] === $arr["owner-link"]) OR ($arr["parent-uri"] === $arr["uri"])));
|
$update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));
|
||||||
|
|
||||||
// Is it a forum? Then we don't care about the rules from above
|
// Is it a forum? Then we don't care about the rules from above
|
||||||
if (!$update AND ($arr["network"] == NETWORK_DFRN) AND ($arr["parent-uri"] === $arr["uri"])) {
|
if (!$update && ($arr["network"] == NETWORK_DFRN) && ($arr["parent-uri"] === $arr["uri"])) {
|
||||||
$isforum = q("SELECT `forum` FROM `contact` WHERE `id` = %d AND `forum`",
|
$isforum = q("SELECT `forum` FROM `contact` WHERE `id` = %d AND `forum`",
|
||||||
intval($arr['contact-id']));
|
intval($arr['contact-id']));
|
||||||
if (dbm::is_result($isforum)) {
|
if (dbm::is_result($isforum)) {
|
||||||
|
@ -1282,7 +1282,7 @@ function get_item_id($guid, $uid = 0) {
|
||||||
// Does the given user have this item?
|
// Does the given user have this item?
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `item`.`moderated` = 0
|
||||||
AND `item`.`guid` = '%s' AND `item`.`uid` = %d", dbesc($guid), intval($uid));
|
AND `item`.`guid` = '%s' AND `item`.`uid` = %d", dbesc($guid), intval($uid));
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
$id = $r[0]["id"];
|
$id = $r[0]["id"];
|
||||||
|
@ -1293,7 +1293,7 @@ function get_item_id($guid, $uid = 0) {
|
||||||
// Or is it anywhere on the server?
|
// Or is it anywhere on the server?
|
||||||
if ($nick == "") {
|
if ($nick == "") {
|
||||||
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
$r = q("SELECT `item`.`id`, `user`.`nickname` FROM `item` INNER JOIN `user` ON `user`.`uid` = `item`.`uid`
|
||||||
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0
|
WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 AND `item`.`moderated` = 0
|
||||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
||||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''
|
||||||
AND `item`.`private` = 0 AND `item`.`wall` = 1
|
AND `item`.`private` = 0 AND `item`.`wall` = 1
|
||||||
|
@ -1600,7 +1600,7 @@ function item_is_remote_self($contact, &$datarray) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($contact['network'] != NETWORK_FEED) AND $datarray['private']) {
|
if (($contact['network'] != NETWORK_FEED) && $datarray['private']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,7 +1701,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
|
||||||
intval($importer['uid'])
|
intval($importer['uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
|
if (dbm::is_result($r) && !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
|
||||||
|
|
||||||
// create notification
|
// create notification
|
||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
|
@ -1741,7 +1741,7 @@ function new_follower($importer, $contact, $datarray, $item, $sharing = false) {
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
} elseif (dbm::is_result($r) AND in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
|
} elseif (dbm::is_result($r) && in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
|
||||||
$r = q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
|
$r = q("UPDATE `contact` SET `pending` = 0 WHERE `uid` = %d AND `url` = '%s' AND `pending` LIMIT 1",
|
||||||
intval($importer['uid']),
|
intval($importer['uid']),
|
||||||
dbesc($url)
|
dbesc($url)
|
||||||
|
@ -1803,7 +1803,7 @@ function subscribe_to_hub($url, $importer, $contact, $hubmode = 'subscribe') {
|
||||||
|
|
||||||
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
logger('subscribe_to_hub: ' . $hubmode . ' ' . $contact['name'] . ' to hub ' . $url . ' endpoint: ' . $push_url . ' with verifier ' . $verify_token);
|
||||||
|
|
||||||
if (!strlen($contact['hub-verify']) OR ($contact['hub-verify'] != $verify_token)) {
|
if (!strlen($contact['hub-verify']) || ($contact['hub-verify'] != $verify_token)) {
|
||||||
$r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d",
|
$r = q("UPDATE `contact` SET `hub-verify` = '%s' WHERE `id` = %d",
|
||||||
dbesc($verify_token),
|
dbesc($verify_token),
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
|
@ -2076,7 +2076,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
|
||||||
drop_item($item['id'], false);
|
drop_item($item['id'], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
|
proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2099,7 +2099,7 @@ function drop_items($items) {
|
||||||
// multiple threads may have been deleted, send an expire notification
|
// multiple threads may have been deleted, send an expire notification
|
||||||
|
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
|
proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2290,11 +2290,12 @@ function drop_item($id, $interactive = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send the notification upstream/downstream
|
||||||
|
// The priority depends on how the deletion is done.
|
||||||
$drop_id = intval($item['id']);
|
$drop_id = intval($item['id']);
|
||||||
|
$priority = ($interactive ? PRIORITY_HIGH : PRIORITY_LOW);
|
||||||
|
|
||||||
// send the notification upstream/downstream as the case may be
|
proc_run($priority, "include/notifier.php", "drop", $drop_id);
|
||||||
|
|
||||||
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
|
|
||||||
|
|
||||||
if (! $interactive) {
|
if (! $interactive) {
|
||||||
return $owner;
|
return $owner;
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// Provide some ability to lock a PHP function so that multiple processes
|
|
||||||
// can't run the function concurrently
|
|
||||||
if (! function_exists('lock_function')) {
|
|
||||||
function lock_function($fn_name, $block = true, $wait_sec = 2, $timeout = 30) {
|
|
||||||
if ( $wait_sec == 0 )
|
|
||||||
$wait_sec = 2; // don't let the user pick a value that's likely to crash the system
|
|
||||||
|
|
||||||
$got_lock = false;
|
|
||||||
$start = time();
|
|
||||||
|
|
||||||
do {
|
|
||||||
q("LOCK TABLE `locks` WRITE");
|
|
||||||
$r = q("SELECT `locked`, `created` FROM `locks` WHERE `name` = '%s' LIMIT 1",
|
|
||||||
dbesc($fn_name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ((dbm::is_result($r)) AND (!$r[0]['locked'] OR (strtotime($r[0]['created']) < time() - 3600))) {
|
|
||||||
q("UPDATE `locks` SET `locked` = 1, `created` = '%s' WHERE `name` = '%s'",
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($fn_name)
|
|
||||||
);
|
|
||||||
$got_lock = true;
|
|
||||||
}
|
|
||||||
elseif (! dbm::is_result($r)) {
|
|
||||||
/// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $r
|
|
||||||
q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
|
|
||||||
dbesc($fn_name),
|
|
||||||
dbesc(datetime_convert())
|
|
||||||
);
|
|
||||||
$got_lock = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
q("UNLOCK TABLES");
|
|
||||||
|
|
||||||
if (($block) && (! $got_lock))
|
|
||||||
sleep($wait_sec);
|
|
||||||
|
|
||||||
} while (($block) && (! $got_lock) && ((time() - $start) < $timeout));
|
|
||||||
|
|
||||||
logger('lock_function: function ' . $fn_name . ' with blocking = ' . $block . ' got_lock = ' . $got_lock . ' time = ' . (time() - $start), LOGGER_DEBUG);
|
|
||||||
|
|
||||||
return $got_lock;
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|
||||||
if (! function_exists('block_on_function_lock')) {
|
|
||||||
function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
|
||||||
if ( $wait_sec == 0 )
|
|
||||||
$wait_sec = 2; // don't let the user pick a value that's likely to crash the system
|
|
||||||
|
|
||||||
$start = time();
|
|
||||||
|
|
||||||
do {
|
|
||||||
$r = q("SELECT locked FROM locks WHERE name = '%s' LIMIT 1",
|
|
||||||
dbesc($fn_name)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (dbm::is_result($r) && $r[0]['locked']) {
|
|
||||||
sleep($wait_sec);
|
|
||||||
}
|
|
||||||
|
|
||||||
} while (dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}}
|
|
||||||
|
|
||||||
|
|
||||||
if (! function_exists('unlock_function')) {
|
|
||||||
function unlock_function($fn_name) {
|
|
||||||
$r = q("UPDATE `locks` SET `locked` = 0, `created` = '%s' WHERE `name` = '%s'",
|
|
||||||
dbesc(NULL_DATE),
|
|
||||||
dbesc($fn_name)
|
|
||||||
);
|
|
||||||
|
|
||||||
logger('unlock_function: released lock for function ' . $fn_name, LOGGER_DEBUG);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}}
|
|
|
@ -108,7 +108,7 @@ function send_message($recipient=0, $body='', $subject='', $replyto=''){
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `mail` WHERE `uri` = '%s' and `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `mail` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($uri),
|
dbesc($uri),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
|
@ -124,7 +124,7 @@ function removesig($message)
|
||||||
|
|
||||||
// Sollte sich der Signaturtrenner innerhalb eines Quotes befinden
|
// Sollte sich der Signaturtrenner innerhalb eines Quotes befinden
|
||||||
// wird keine Signaturtrennung ausgefuehrt
|
// wird keine Signaturtrennung ausgefuehrt
|
||||||
if (($sigpos < $quotepos) and ($sigpos != 0))
|
if (($sigpos < $quotepos) && ($sigpos != 0))
|
||||||
return(array('body' => $message, 'sig' => ''));
|
return(array('body' => $message, 'sig' => ''));
|
||||||
|
|
||||||
/// @TODO Regexp umstellen, so dass auf 1 oder kein Leerzeichen
|
/// @TODO Regexp umstellen, so dass auf 1 oder kein Leerzeichen
|
||||||
|
@ -135,7 +135,7 @@ function removesig($message)
|
||||||
|
|
||||||
preg_match($pattern, $message, $result);
|
preg_match($pattern, $message, $result);
|
||||||
|
|
||||||
if (($result[1] != '') and ($result[2] != '')) {
|
if (($result[1] != '') && ($result[2] != '')) {
|
||||||
$cleaned = trim($result[1])."\n";
|
$cleaned = trim($result[1])."\n";
|
||||||
$sig = trim($result[2]);
|
$sig = trim($result[2]);
|
||||||
// '[hr][size=x-small][color=darkblue]'.trim($result[2]).'[/color][/size]';
|
// '[hr][size=x-small][color=darkblue]'.trim($result[2]).'[/color][/size]';
|
||||||
|
@ -157,8 +157,8 @@ function removelinebreak($message)
|
||||||
foreach ($arrbody as $i => $line) {
|
foreach ($arrbody as $i => $line) {
|
||||||
$currquotelevel = 0;
|
$currquotelevel = 0;
|
||||||
$currline = $line;
|
$currline = $line;
|
||||||
while ((strlen($currline)>0) and ((substr($currline, 0, 1) == '>')
|
while ((strlen($currline)>0) && ((substr($currline, 0, 1) == '>')
|
||||||
or (substr($currline, 0, 1) == ' '))) {
|
|| (substr($currline, 0, 1) == ' '))) {
|
||||||
if (substr($currline, 0, 1) == '>')
|
if (substr($currline, 0, 1) == '>')
|
||||||
$currquotelevel++;
|
$currquotelevel++;
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ function removelinebreak($message)
|
||||||
|
|
||||||
$quotelevel = 0;
|
$quotelevel = 0;
|
||||||
$nextline = trim($arrbody[$i+1]);
|
$nextline = trim($arrbody[$i+1]);
|
||||||
while ((strlen($nextline)>0) and ((substr($nextline, 0, 1) == '>')
|
while ((strlen($nextline)>0) && ((substr($nextline, 0, 1) == '>')
|
||||||
or (substr($nextline, 0, 1) == ' '))) {
|
|| (substr($nextline, 0, 1) == ' '))) {
|
||||||
if (substr($nextline, 0, 1) == '>')
|
if (substr($nextline, 0, 1) == '>')
|
||||||
$quotelevel++;
|
$quotelevel++;
|
||||||
|
|
||||||
|
@ -178,21 +178,21 @@ function removelinebreak($message)
|
||||||
$len = strlen($line);
|
$len = strlen($line);
|
||||||
$firstword = strpos($nextline.' ', ' ');
|
$firstword = strpos($nextline.' ', ' ');
|
||||||
|
|
||||||
$specialchars = ((substr(trim($nextline), 0, 1) == '-') or
|
$specialchars = ((substr(trim($nextline), 0, 1) == '-') ||
|
||||||
(substr(trim($nextline), 0, 1) == '=') or
|
(substr(trim($nextline), 0, 1) == '=') ||
|
||||||
(substr(trim($nextline), 0, 1) == '*') or
|
(substr(trim($nextline), 0, 1) == '*') ||
|
||||||
(substr(trim($nextline), 0, 1) == '·') or
|
(substr(trim($nextline), 0, 1) == '·') ||
|
||||||
(substr(trim($nextline), 0, 4) == '[url') or
|
(substr(trim($nextline), 0, 4) == '[url') ||
|
||||||
(substr(trim($nextline), 0, 5) == '[size') or
|
(substr(trim($nextline), 0, 5) == '[size') ||
|
||||||
(substr(trim($nextline), 0, 7) == 'http://') or
|
(substr(trim($nextline), 0, 7) == 'http://') ||
|
||||||
(substr(trim($nextline), 0, 8) == 'https://'));
|
(substr(trim($nextline), 0, 8) == 'https://'));
|
||||||
|
|
||||||
if (!$specialchars)
|
if (!$specialchars)
|
||||||
$specialchars = ((substr(rtrim($line), -1) == '-') or
|
$specialchars = ((substr(rtrim($line), -1) == '-') ||
|
||||||
(substr(rtrim($line), -1) == '=') or
|
(substr(rtrim($line), -1) == '=') ||
|
||||||
(substr(rtrim($line), -1) == '*') or
|
(substr(rtrim($line), -1) == '*') ||
|
||||||
(substr(rtrim($line), -1) == '·') or
|
(substr(rtrim($line), -1) == '·') ||
|
||||||
(substr(rtrim($line), -6) == '[/url]') or
|
(substr(rtrim($line), -6) == '[/url]') ||
|
||||||
(substr(rtrim($line), -7) == '[/size]'));
|
(substr(rtrim($line), -7) == '[/size]'));
|
||||||
|
|
||||||
//if ($specialchars)
|
//if ($specialchars)
|
||||||
|
@ -202,8 +202,8 @@ function removelinebreak($message)
|
||||||
if (substr($lines[$lineno], -1) != ' ')
|
if (substr($lines[$lineno], -1) != ' ')
|
||||||
$lines[$lineno] .= ' ';
|
$lines[$lineno] .= ' ';
|
||||||
|
|
||||||
while ((strlen($line)>0) and ((substr($line, 0, 1) == '>')
|
while ((strlen($line)>0) && ((substr($line, 0, 1) == '>')
|
||||||
or (substr($line, 0, 1) == ' '))) {
|
|| (substr($line, 0, 1) == ' '))) {
|
||||||
|
|
||||||
$line = ltrim(substr($line, 1));
|
$line = ltrim(substr($line, 1));
|
||||||
}
|
}
|
||||||
|
@ -213,10 +213,10 @@ function removelinebreak($message)
|
||||||
// $lines[$lineno] = $quotelevel.'-'.$len.'-'.$firstword.'-';
|
// $lines[$lineno] = $quotelevel.'-'.$len.'-'.$firstword.'-';
|
||||||
|
|
||||||
$lines[$lineno] .= $line;
|
$lines[$lineno] .= $line;
|
||||||
//if ((($len + $firstword < 68) and (substr($line, -1, 1) != ' '))
|
//if ((($len + $firstword < 68) && (substr($line, -1, 1) != ' '))
|
||||||
// or ($quotelevel != $currquotelevel) or $specialchars)
|
// || ($quotelevel != $currquotelevel) || $specialchars)
|
||||||
if (((substr($line, -1, 1) != ' '))
|
if (((substr($line, -1, 1) != ' '))
|
||||||
or ($quotelevel != $currquotelevel))
|
|| ($quotelevel != $currquotelevel))
|
||||||
$lineno++;
|
$lineno++;
|
||||||
}
|
}
|
||||||
return(implode("\n", $lines));
|
return(implode("\n", $lines));
|
||||||
|
|
|
@ -121,7 +121,7 @@ function nav_info(App $a)
|
||||||
$nav['apps'] = array('apps', t('Apps'), '', t('Addon applications, utilities, games'));
|
$nav['apps'] = array('apps', t('Apps'), '', t('Addon applications, utilities, games'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (local_user() OR !get_config('system', 'local_search')) {
|
if (local_user() || !get_config('system', 'local_search')) {
|
||||||
$nav['search'] = array('search', t('Search'), '', t('Search site content'));
|
$nav['search'] = array('search', t('Search'), '', t('Search site content'));
|
||||||
|
|
||||||
$nav['searchoption'] = array(
|
$nav['searchoption'] = array(
|
||||||
|
|
|
@ -187,7 +187,7 @@ function z_fetch_url($url, $binary = false, &$redirects = 0, $opts = array()) {
|
||||||
|
|
||||||
$newurl = $curl_info['redirect_url'];
|
$newurl = $curl_info['redirect_url'];
|
||||||
|
|
||||||
if (($new_location_info['path'] == '') AND ( $new_location_info['host'] != '')) {
|
if (($new_location_info['path'] == '') && ( $new_location_info['host'] != '')) {
|
||||||
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
|
$newurl = $new_location_info['scheme'] . '://' . $new_location_info['host'] . $old_location_info['path'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,8 +818,8 @@ function original_url($url, $depth = 1, $fetchbody = false) {
|
||||||
if ($http_code == 0)
|
if ($http_code == 0)
|
||||||
return($url);
|
return($url);
|
||||||
|
|
||||||
if ((($curl_info['http_code'] == "301") OR ($curl_info['http_code'] == "302"))
|
if ((($curl_info['http_code'] == "301") || ($curl_info['http_code'] == "302"))
|
||||||
AND (($curl_info['redirect_url'] != "") OR ($curl_info['location'] != ""))) {
|
&& (($curl_info['redirect_url'] != "") || ($curl_info['location'] != ""))) {
|
||||||
if ($curl_info['redirect_url'] != "")
|
if ($curl_info['redirect_url'] != "")
|
||||||
return(original_url($curl_info['redirect_url'], ++$depth, $fetchbody));
|
return(original_url($curl_info['redirect_url'], ++$depth, $fetchbody));
|
||||||
else
|
else
|
||||||
|
@ -835,7 +835,7 @@ function original_url($url, $depth = 1, $fetchbody = false) {
|
||||||
return($url);
|
return($url);
|
||||||
|
|
||||||
// if it isn't a HTML file then exit
|
// if it isn't a HTML file then exit
|
||||||
if (($curl_info["content_type"] != "") AND !strstr(strtolower($curl_info["content_type"]),"html"))
|
if (($curl_info["content_type"] != "") && !strstr(strtolower($curl_info["content_type"]),"html"))
|
||||||
return($url);
|
return($url);
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
|
@ -929,7 +929,7 @@ function json_return_and_die($x) {
|
||||||
*/
|
*/
|
||||||
function matching_url($url1, $url2) {
|
function matching_url($url1, $url2) {
|
||||||
|
|
||||||
if (($url1 == "") OR ($url2 == ""))
|
if (($url1 == "") || ($url2 == ""))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
$url1 = normalise_link($url1);
|
$url1 = normalise_link($url1);
|
||||||
|
@ -938,7 +938,7 @@ function matching_url($url1, $url2) {
|
||||||
$parts1 = parse_url($url1);
|
$parts1 = parse_url($url1);
|
||||||
$parts2 = parse_url($url2);
|
$parts2 = parse_url($url2);
|
||||||
|
|
||||||
if (!isset($parts1["host"]) OR !isset($parts2["host"]))
|
if (!isset($parts1["host"]) || !isset($parts2["host"]))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if ($parts1["scheme"] != $parts2["scheme"])
|
if ($parts1["scheme"] != $parts2["scheme"])
|
||||||
|
@ -967,7 +967,7 @@ function matching_url($url1, $url2) {
|
||||||
if ($path1 == $path2)
|
if ($path1 == $path2)
|
||||||
$path .= $path1."/";
|
$path .= $path1."/";
|
||||||
|
|
||||||
} while (($path1 == $path2) AND ($i++ <= count($pathparts1)));
|
} while (($path1 == $path2) && ($i++ <= count($pathparts1)));
|
||||||
|
|
||||||
$match .= $path;
|
$match .= $path;
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,17 @@ function notifier_run(&$argv, &$argc){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inherit the priority
|
||||||
|
$queue = dba::select('workerqueue', array('priority'), array('pid' => getmypid()), array('limit' => 1));
|
||||||
|
if (dbm::is_result($queue)) {
|
||||||
|
$priority = (int)$queue['priority'];
|
||||||
|
logger('inherited priority: '.$priority);
|
||||||
|
} else {
|
||||||
|
// Normally this shouldn't happen.
|
||||||
|
$priority = PRIORITY_HIGH;
|
||||||
|
logger('no inherited priority! Something is wrong.');
|
||||||
|
}
|
||||||
|
|
||||||
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
|
logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
|
||||||
|
|
||||||
$cmd = $argv[1];
|
$cmd = $argv[1];
|
||||||
|
@ -152,7 +163,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
$recipients_relocate = q("SELECT * FROM contact WHERE uid = %d AND self = 0 AND network = '%s'" , intval($uid), NETWORK_DFRN);
|
$recipients_relocate = q("SELECT * FROM contact WHERE uid = %d AND self = 0 AND network = '%s'" , intval($uid), NETWORK_DFRN);
|
||||||
} else {
|
} else {
|
||||||
// find ancestors
|
// find ancestors
|
||||||
$r = q("SELECT * FROM `item` WHERE `id` = %d and visible = 1 and moderated = 0 LIMIT 1",
|
$r = q("SELECT * FROM `item` WHERE `id` = %d AND visible = 1 AND moderated = 0 LIMIT 1",
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -166,7 +177,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
$updated = $r[0]['edited'];
|
$updated = $r[0]['edited'];
|
||||||
|
|
||||||
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
$items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
|
||||||
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d and visible = 1 and moderated = 0 ORDER BY `id` ASC",
|
FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible = 1 AND moderated = 0 ORDER BY `id` ASC",
|
||||||
intval($parent_id)
|
intval($parent_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -295,13 +306,13 @@ function notifier_run(&$argv, &$argc){
|
||||||
$recipients = array($parent['contact-id']);
|
$recipients = array($parent['contact-id']);
|
||||||
$recipients_followup = array($parent['contact-id']);
|
$recipients_followup = array($parent['contact-id']);
|
||||||
|
|
||||||
//if (!$target_item['private'] AND $target_item['wall'] AND
|
//if (!$target_item['private'] && $target_item['wall'] &&
|
||||||
if (!$target_item['private'] AND
|
if (!$target_item['private'] &&
|
||||||
(strlen($target_item['allow_cid'].$target_item['allow_gid'].
|
(strlen($target_item['allow_cid'].$target_item['allow_gid'].
|
||||||
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
|
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
|
||||||
$push_notify = true;
|
$push_notify = true;
|
||||||
|
|
||||||
if (($thr_parent AND ($thr_parent[0]['network'] == NETWORK_OSTATUS)) OR ($parent['network'] == NETWORK_OSTATUS)) {
|
if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||||
|
|
||||||
$push_notify = true;
|
$push_notify = true;
|
||||||
|
|
||||||
|
@ -348,7 +359,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
// a delivery fork. private groups (forum_mode == 2) do not uplink
|
// a delivery fork. private groups (forum_mode == 2) do not uplink
|
||||||
|
|
||||||
if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
|
if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
|
||||||
proc_run(PRIORITY_HIGH,'include/notifier.php','uplink',$item_id);
|
proc_run($priority, 'include/notifier.php', 'uplink', $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$conversants = array();
|
$conversants = array();
|
||||||
|
@ -385,7 +396,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
|
|
||||||
// If the thread parent is OStatus then do some magic to distribute the messages.
|
// If the thread parent is OStatus then do some magic to distribute the messages.
|
||||||
// We have not only to look at the parent, since it could be a Friendica thread.
|
// We have not only to look at the parent, since it could be a Friendica thread.
|
||||||
if (($thr_parent AND ($thr_parent[0]['network'] == NETWORK_OSTATUS)) OR ($parent['network'] == NETWORK_OSTATUS)) {
|
if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
|
||||||
|
|
||||||
$diaspora_delivery = false;
|
$diaspora_delivery = false;
|
||||||
|
|
||||||
|
@ -487,7 +498,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
|
logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
|
||||||
|
|
||||||
proc_run(PRIORITY_HIGH,'include/delivery.php', $cmd, $item_id, $contact['id']);
|
proc_run(array('priority' => $priority, 'dont_fork' => true), 'include/delivery.php', $cmd, $item_id, $contact['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +563,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
|
|
||||||
if ((! $mail) && (! $fsuggest) && (! $followup)) {
|
if ((! $mail) && (! $fsuggest) && (! $followup)) {
|
||||||
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
|
logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
|
||||||
proc_run(PRIORITY_HIGH,'include/delivery.php',$cmd,$item_id,$rr['id']);
|
proc_run(array('priority' => $priority, 'dont_fork' => true), 'include/delivery.php', $cmd, $item_id, $rr['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +573,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify PuSH subscribers (Used for OStatus distribution of regular posts)
|
// Notify PuSH subscribers (Used for OStatus distribution of regular posts)
|
||||||
if ($push_notify AND strlen($hub)) {
|
if ($push_notify && strlen($hub)) {
|
||||||
$hubs = explode(',', $hub);
|
$hubs = explode(',', $hub);
|
||||||
if (count($hubs)) {
|
if (count($hubs)) {
|
||||||
foreach ($hubs as $h) {
|
foreach ($hubs as $h) {
|
||||||
|
@ -592,7 +603,7 @@ function notifier_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling the pubsubhubbub requests
|
// Handling the pubsubhubbub requests
|
||||||
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
|
proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'include/pubsubpublish.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('notifier: calling hooks', LOGGER_DEBUG);
|
logger('notifier: calling hooks', LOGGER_DEBUG);
|
||||||
|
|
|
@ -108,7 +108,7 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
|
||||||
$j->embedurl = $embedurl;
|
$j->embedurl = $embedurl;
|
||||||
|
|
||||||
// If fetching information doesn't work, then improve via internal functions
|
// If fetching information doesn't work, then improve via internal functions
|
||||||
if (($j->type == "error") OR ($no_rich_type AND ($j->type == "rich"))) {
|
if (($j->type == "error") || ($no_rich_type && ($j->type == "rich"))) {
|
||||||
$data = ParseUrl::getSiteinfoCached($embedurl, true, false);
|
$data = ParseUrl::getSiteinfoCached($embedurl, true, false);
|
||||||
$j->type = $data["type"];
|
$j->type = $data["type"];
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ function oembed_format_object($j){
|
||||||
if (isset($j->author_name)) {
|
if (isset($j->author_name)) {
|
||||||
$ret.=" (".$j->author_name.")";
|
$ret.=" (".$j->author_name.")";
|
||||||
}
|
}
|
||||||
} elseif (isset($j->provider_name) OR isset($j->author_name)) {
|
} elseif (isset($j->provider_name) || isset($j->author_name)) {
|
||||||
$embedlink = "";
|
$embedlink = "";
|
||||||
if (isset($j->provider_name)) {
|
if (isset($j->provider_name)) {
|
||||||
$embedlink .= $j->provider_name;
|
$embedlink .= $j->provider_name;
|
||||||
|
|
|
@ -68,9 +68,9 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$contact = $contacts[0];
|
$contact = $contacts[0];
|
||||||
|
|
||||||
// load current friends if possible.
|
// load current friends if possible.
|
||||||
if (($contact['poco'] != "") AND ($contact['success_update'] > $contact['failure_update'])) {
|
if (($contact['poco'] != "") && ($contact['success_update'] > $contact['failure_update'])) {
|
||||||
$r = q("SELECT count(*) as total from glink
|
$r = q("SELECT count(*) AS total FROM glink
|
||||||
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
|
WHERE `cid` = %d AND updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
|
@ -395,7 +395,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
logger("Mail: Seen before ".$msg_uid." for ".$mailconf[0]['user']." UID: ".$importer_uid." URI: ".$datarray['uri'],LOGGER_DEBUG);
|
||||||
|
|
||||||
// Only delete when mails aren't automatically moved or deleted
|
// Only delete when mails aren't automatically moved or deleted
|
||||||
if (($mailconf[0]['action'] != 1) AND ($mailconf[0]['action'] != 3))
|
if (($mailconf[0]['action'] != 1) && ($mailconf[0]['action'] != 3))
|
||||||
if ($meta->deleted && ! $r[0]['deleted']) {
|
if ($meta->deleted && ! $r[0]['deleted']) {
|
||||||
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d",
|
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
|
@ -467,15 +467,15 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
|
$datarray['created'] = datetime_convert('UTC','UTC',$meta->date);
|
||||||
|
|
||||||
// Is it a reply?
|
// Is it a reply?
|
||||||
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") or
|
$reply = ((substr(strtolower($datarray['title']), 0, 3) == "re:") ||
|
||||||
(substr(strtolower($datarray['title']), 0, 3) == "re-") or
|
(substr(strtolower($datarray['title']), 0, 3) == "re-") ||
|
||||||
($raw_refs != ""));
|
($raw_refs != ""));
|
||||||
|
|
||||||
// Remove Reply-signs in the subject
|
// Remove Reply-signs in the subject
|
||||||
$datarray['title'] = RemoveReply($datarray['title']);
|
$datarray['title'] = RemoveReply($datarray['title']);
|
||||||
|
|
||||||
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
|
// If it seems to be a reply but a header couldn't be found take the last message with matching subject
|
||||||
if (!x($datarray,'parent-uri') and $reply) {
|
if (!x($datarray,'parent-uri') && $reply) {
|
||||||
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d AND `network` = '%s' ORDER BY `created` DESC LIMIT 1",
|
$r = q("SELECT `uri` , `parent-uri` FROM `item` WHERE `title` = \"%s\" AND `uid` = %d AND `network` = '%s' ORDER BY `created` DESC LIMIT 1",
|
||||||
dbesc(protect_sprintf($datarray['title'])),
|
dbesc(protect_sprintf($datarray['title'])),
|
||||||
intval($importer_uid),
|
intval($importer_uid),
|
||||||
|
|
|
@ -54,7 +54,7 @@ class ostatus {
|
||||||
$alternate = $xpath->query("atom:author/atom:link[@rel='alternate']", $context)->item(0)->attributes;
|
$alternate = $xpath->query("atom:author/atom:link[@rel='alternate']", $context)->item(0)->attributes;
|
||||||
if (is_object($alternate)) {
|
if (is_object($alternate)) {
|
||||||
foreach ($alternate AS $attributes) {
|
foreach ($alternate AS $attributes) {
|
||||||
if (($attributes->name == "href") AND ($attributes->textContent != "")) {
|
if (($attributes->name == "href") && ($attributes->textContent != "")) {
|
||||||
$author["author-link"] = $attributes->textContent;
|
$author["author-link"] = $attributes->textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class ostatus {
|
||||||
$width = $attributes->textContent;
|
$width = $attributes->textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($width > 0) AND ($href != "")) {
|
if (($width > 0) && ($href != "")) {
|
||||||
$avatarlist[$width] = $href;
|
$avatarlist[$width] = $href;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ class ostatus {
|
||||||
$author["owner-avatar"] = $author["author-avatar"];
|
$author["owner-avatar"] = $author["author-avatar"];
|
||||||
|
|
||||||
// Only update the contacts if it is an OStatus contact
|
// Only update the contacts if it is an OStatus contact
|
||||||
if ($r AND !$onlyfetch AND ($contact["network"] == NETWORK_OSTATUS)) {
|
if ($r && !$onlyfetch && ($contact["network"] == NETWORK_OSTATUS)) {
|
||||||
|
|
||||||
// Update contact data
|
// Update contact data
|
||||||
|
|
||||||
|
@ -153,8 +153,8 @@ class ostatus {
|
||||||
if ($value != "")
|
if ($value != "")
|
||||||
$contact["location"] = $value;
|
$contact["location"] = $value;
|
||||||
|
|
||||||
if (($contact["name"] != $r[0]["name"]) OR ($contact["nick"] != $r[0]["nick"]) OR ($contact["about"] != $r[0]["about"]) OR
|
if (($contact["name"] != $r[0]["name"]) || ($contact["nick"] != $r[0]["nick"]) || ($contact["about"] != $r[0]["about"]) ||
|
||||||
($contact["alias"] != $r[0]["alias"]) OR ($contact["location"] != $r[0]["location"])) {
|
($contact["alias"] != $r[0]["alias"]) || ($contact["location"] != $r[0]["location"])) {
|
||||||
|
|
||||||
logger("Update contact data for contact ".$contact["id"], LOGGER_DEBUG);
|
logger("Update contact data for contact ".$contact["id"], LOGGER_DEBUG);
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class ostatus {
|
||||||
dbesc(datetime_convert()), intval($contact["id"]));
|
dbesc(datetime_convert()), intval($contact["id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($author["author-avatar"]) AND ($author["author-avatar"] != $r[0]['avatar'])) {
|
if (isset($author["author-avatar"]) && ($author["author-avatar"] != $r[0]['avatar'])) {
|
||||||
logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
logger("Update profile picture for contact ".$contact["id"], LOGGER_DEBUG);
|
||||||
|
|
||||||
update_contact_avatar($author["author-avatar"], $importer["uid"], $contact["id"]);
|
update_contact_avatar($author["author-avatar"], $importer["uid"], $contact["id"]);
|
||||||
|
@ -354,13 +354,13 @@ class ostatus {
|
||||||
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
|
$item["verb"] = $xpath->query('activity:verb/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
// Mastodon Content Warning
|
// Mastodon Content Warning
|
||||||
if (($item["verb"] == ACTIVITY_POST) AND $xpath->evaluate('boolean(atom:summary)', $entry)) {
|
if (($item["verb"] == ACTIVITY_POST) && $xpath->evaluate('boolean(atom:summary)', $entry)) {
|
||||||
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
$clear_text = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
|
$item["body"] = html2bbcode($clear_text) . '[spoiler]' . $item["body"] . '[/spoiler]';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) OR ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
||||||
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
|
$item["title"] = $xpath->query('atom:title/text()', $entry)->item(0)->nodeValue;
|
||||||
$item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
$item["body"] = $xpath->query('atom:summary/text()', $entry)->item(0)->nodeValue;
|
||||||
} elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) {
|
} elseif ($item["object-type"] == ACTIVITY_OBJ_QUESTION) {
|
||||||
|
@ -469,11 +469,11 @@ class ostatus {
|
||||||
foreach ($links AS $link) {
|
foreach ($links AS $link) {
|
||||||
$attribute = self::read_attributes($link);
|
$attribute = self::read_attributes($link);
|
||||||
|
|
||||||
if (($attribute['rel'] != "") AND ($attribute['href'] != "")) {
|
if (($attribute['rel'] != "") && ($attribute['href'] != "")) {
|
||||||
switch ($attribute['rel']) {
|
switch ($attribute['rel']) {
|
||||||
case "alternate":
|
case "alternate":
|
||||||
$item["plink"] = $attribute['href'];
|
$item["plink"] = $attribute['href'];
|
||||||
if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) OR
|
if (($item["object-type"] == ACTIVITY_OBJ_QUESTION) ||
|
||||||
($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
||||||
$item["body"] .= add_page_info($attribute['href']);
|
$item["body"] .= add_page_info($attribute['href']);
|
||||||
}
|
}
|
||||||
|
@ -525,7 +525,7 @@ class ostatus {
|
||||||
$repeat_of = "";
|
$repeat_of = "";
|
||||||
|
|
||||||
$notice_info = $xpath->query('statusnet:notice_info', $entry);
|
$notice_info = $xpath->query('statusnet:notice_info', $entry);
|
||||||
if ($notice_info AND ($notice_info->length > 0)) {
|
if ($notice_info && ($notice_info->length > 0)) {
|
||||||
foreach ($notice_info->item(0)->attributes AS $attributes) {
|
foreach ($notice_info->item(0)->attributes AS $attributes) {
|
||||||
if ($attributes->name == "source") {
|
if ($attributes->name == "source") {
|
||||||
$item["app"] = strip_tags($attributes->textContent);
|
$item["app"] = strip_tags($attributes->textContent);
|
||||||
|
@ -540,7 +540,7 @@ class ostatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it a repeated post?
|
// Is it a repeated post?
|
||||||
if (($repeat_of != "") OR ($item["verb"] == ACTIVITY_SHARE)) {
|
if (($repeat_of != "") || ($item["verb"] == ACTIVITY_SHARE)) {
|
||||||
$activityobjects = $xpath->query('activity:object', $entry)->item(0);
|
$activityobjects = $xpath->query('activity:object', $entry)->item(0);
|
||||||
|
|
||||||
if (is_object($activityobjects)) {
|
if (is_object($activityobjects)) {
|
||||||
|
@ -550,7 +550,7 @@ class ostatus {
|
||||||
$orig_uri = $xpath->query('atom:id/text()', $activityobjects)->item(0)->nodeValue;
|
$orig_uri = $xpath->query('atom:id/text()', $activityobjects)->item(0)->nodeValue;
|
||||||
}
|
}
|
||||||
$orig_links = $xpath->query("activity:object/atom:link[@rel='alternate']", $activityobjects);
|
$orig_links = $xpath->query("activity:object/atom:link[@rel='alternate']", $activityobjects);
|
||||||
if ($orig_links AND ($orig_links->length > 0)) {
|
if ($orig_links && ($orig_links->length > 0)) {
|
||||||
foreach ($orig_links->item(0)->attributes AS $attributes) {
|
foreach ($orig_links->item(0)->attributes AS $attributes) {
|
||||||
if ($attributes->name == "href") {
|
if ($attributes->name == "href") {
|
||||||
$orig_link = $attributes->textContent;
|
$orig_link = $attributes->textContent;
|
||||||
|
@ -621,8 +621,8 @@ class ostatus {
|
||||||
intval($importer["uid"]), dbesc($item["parent-uri"]));
|
intval($importer["uid"]), dbesc($item["parent-uri"]));
|
||||||
|
|
||||||
// Only fetch missing stuff if it is a comment or reshare.
|
// Only fetch missing stuff if it is a comment or reshare.
|
||||||
if (in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_SHARE)) AND
|
if (in_array($item["verb"], array(ACTIVITY_POST, ACTIVITY_SHARE)) &&
|
||||||
!dbm::is_result($r) AND ($related != "")) {
|
!dbm::is_result($r) && ($related != "")) {
|
||||||
$reply_path = str_replace("/notice/", "/api/statuses/show/", $related).".atom";
|
$reply_path = str_replace("/notice/", "/api/statuses/show/", $related).".atom";
|
||||||
|
|
||||||
if ($reply_path != $related) {
|
if ($reply_path != $related) {
|
||||||
|
@ -647,6 +647,9 @@ class ostatus {
|
||||||
$item_id = self::completion($conversation, $importer["uid"], $item, $self);
|
$item_id = self::completion($conversation, $importer["uid"], $item, $self);
|
||||||
|
|
||||||
if (!$item_id) {
|
if (!$item_id) {
|
||||||
|
// Store the conversation data. This is normally done in "item_store"
|
||||||
|
// but since something went wrong, we want to be sure to save the data.
|
||||||
|
store_conversation($item);
|
||||||
logger("Error storing item", LOGGER_DEBUG);
|
logger("Error storing item", LOGGER_DEBUG);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -665,16 +668,16 @@ class ostatus {
|
||||||
public static function convert_href($href) {
|
public static function convert_href($href) {
|
||||||
$elements = explode(":",$href);
|
$elements = explode(":",$href);
|
||||||
|
|
||||||
if ((count($elements) <= 2) OR ($elements[0] != "tag"))
|
if ((count($elements) <= 2) || ($elements[0] != "tag"))
|
||||||
return $href;
|
return $href;
|
||||||
|
|
||||||
$server = explode(",", $elements[1]);
|
$server = explode(",", $elements[1]);
|
||||||
$conversation = explode("=", $elements[2]);
|
$conversation = explode("=", $elements[2]);
|
||||||
|
|
||||||
if ((count($elements) == 4) AND ($elements[2] == "post"))
|
if ((count($elements) == 4) && ($elements[2] == "post"))
|
||||||
return "http://".$server[0]."/notice/".$elements[3];
|
return "http://".$server[0]."/notice/".$elements[3];
|
||||||
|
|
||||||
if ((count($conversation) != 2) OR ($conversation[1] ==""))
|
if ((count($conversation) != 2) || ($conversation[1] ==""))
|
||||||
return $href;
|
return $href;
|
||||||
|
|
||||||
if ($elements[3] == "objectType=thread")
|
if ($elements[3] == "objectType=thread")
|
||||||
|
@ -700,7 +703,7 @@ class ostatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't poll if the interval is set negative
|
// Don't poll if the interval is set negative
|
||||||
if (($poll_interval < 0) AND !$override) {
|
if (($poll_interval < 0) && !$override) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,7 +720,7 @@ class ostatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($last AND !$override) {
|
if ($last && !$override) {
|
||||||
$next = $last + ($poll_interval * 60);
|
$next = $last + ($poll_interval * 60);
|
||||||
if ($next > time()) {
|
if ($next > time()) {
|
||||||
logger('poll interval not reached');
|
logger('poll interval not reached');
|
||||||
|
@ -815,7 +818,7 @@ class ostatus {
|
||||||
if ($conversation_id != "") {
|
if ($conversation_id != "") {
|
||||||
$elements = explode(":", $conversation_id);
|
$elements = explode(":", $conversation_id);
|
||||||
|
|
||||||
if ((count($elements) <= 2) OR ($elements[0] != "tag"))
|
if ((count($elements) <= 2) || ($elements[0] != "tag"))
|
||||||
return $conversation_id;
|
return $conversation_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,6 +843,30 @@ class ostatus {
|
||||||
return $base_url."/conversation/".$conversation_id;
|
return $base_url."/conversation/".$conversation_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fetches a shared object from a given conversation object
|
||||||
|
*
|
||||||
|
* Sometimes GNU Social seems to fail when returning shared objects.
|
||||||
|
* Then they don't contains all needed data.
|
||||||
|
* We then try to find this object in the conversation
|
||||||
|
*
|
||||||
|
* @param string $id Message id
|
||||||
|
* @param object $conversation Conversation object
|
||||||
|
*
|
||||||
|
* @return object The shared object
|
||||||
|
*/
|
||||||
|
private function shared_object($id, $conversation) {
|
||||||
|
if (!is_array($conversation->items)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
foreach ($conversation->items AS $single_conv) {
|
||||||
|
if ($single_conv->id == $id) {
|
||||||
|
return $single_conv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fetches actor details of a given actor and user id
|
* @brief Fetches actor details of a given actor and user id
|
||||||
*
|
*
|
||||||
|
@ -906,12 +933,10 @@ class ostatus {
|
||||||
|
|
||||||
// If the thread shouldn't be completed then store the item and go away
|
// If the thread shouldn't be completed then store the item and go away
|
||||||
// Don't do a completion on liked content
|
// Don't do a completion on liked content
|
||||||
if (((intval(get_config('system','ostatus_poll_interval')) == -2) AND (count($item) > 0)) OR
|
if (((intval(get_config('system','ostatus_poll_interval')) == -2) && (count($item) > 0)) ||
|
||||||
($item["verb"] == ACTIVITY_LIKE) OR ($conversation_url == "")) {
|
($item["verb"] == ACTIVITY_LIKE) || ($conversation_url == "")) {
|
||||||
$item_stored = item_store($item, $all_threads);
|
$item_stored = item_store($item, $all_threads);
|
||||||
return $item_stored;
|
return $item_stored;
|
||||||
} elseif (count($item) > 0) {
|
|
||||||
$item = store_conversation($item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the parent
|
// Get the parent
|
||||||
|
@ -921,14 +946,6 @@ class ostatus {
|
||||||
STRAIGHT_JOIN `item` ON `item`.`parent` = `thritem`.`parent`
|
STRAIGHT_JOIN `item` ON `item`.`parent` = `thritem`.`parent`
|
||||||
WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'",
|
WHERE `term`.`uid` = %d AND `term`.`otype` = %d AND `term`.`type` = %d AND `term`.`url` = '%s'",
|
||||||
intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
|
intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
|
||||||
|
|
||||||
/* 2016-10-23: The old query will be kept until we are sure that the query above is a good and fast replacement
|
|
||||||
|
|
||||||
$parents = q("SELECT `id`, `parent`, `uri`, `contact-id`, `type`, `verb`, `visible` FROM `item` WHERE `id` IN
|
|
||||||
(SELECT `parent` FROM `item` WHERE `id` IN
|
|
||||||
(SELECT `oid` FROM `term` WHERE `uid` = %d AND `otype` = %d AND `type` = %d AND `url` = '%s'))",
|
|
||||||
intval($uid), intval(TERM_OBJ_POST), intval(TERM_CONVERSATION), dbesc($conversation_url));
|
|
||||||
*/
|
|
||||||
if ($parents)
|
if ($parents)
|
||||||
$parent = $parents[0];
|
$parent = $parents[0];
|
||||||
elseif (count($item) > 0) {
|
elseif (count($item) > 0) {
|
||||||
|
@ -962,10 +979,10 @@ class ostatus {
|
||||||
$conv_arr = z_fetch_url($conv."?page=".$pageno);
|
$conv_arr = z_fetch_url($conv."?page=".$pageno);
|
||||||
|
|
||||||
// If it is a non-ssl site and there is an error, then try ssl or vice versa
|
// If it is a non-ssl site and there is an error, then try ssl or vice versa
|
||||||
if (!$conv_arr["success"] AND (substr($conv, 0, 7) == "http://")) {
|
if (!$conv_arr["success"] && (substr($conv, 0, 7) == "http://")) {
|
||||||
$conv = str_replace("http://", "https://", $conv);
|
$conv = str_replace("http://", "https://", $conv);
|
||||||
$conv_as = fetch_url($conv."?page=".$pageno);
|
$conv_as = fetch_url($conv."?page=".$pageno);
|
||||||
} elseif (!$conv_arr["success"] AND (substr($conv, 0, 8) == "https://")) {
|
} elseif (!$conv_arr["success"] && (substr($conv, 0, 8) == "https://")) {
|
||||||
$conv = str_replace("https://", "http://", $conv);
|
$conv = str_replace("https://", "http://", $conv);
|
||||||
$conv_as = fetch_url($conv."?page=".$pageno);
|
$conv_as = fetch_url($conv."?page=".$pageno);
|
||||||
} else
|
} else
|
||||||
|
@ -1040,7 +1057,7 @@ class ostatus {
|
||||||
// 1. Our conversation hasn't the "real" thread starter
|
// 1. Our conversation hasn't the "real" thread starter
|
||||||
// 2. This first post is a post inside our thread
|
// 2. This first post is a post inside our thread
|
||||||
// 3. This first post is a post inside another thread
|
// 3. This first post is a post inside another thread
|
||||||
if (($first_id != $parent["uri"]) AND ($parent["uri"] != "")) {
|
if (($first_id != $parent["uri"]) && ($parent["uri"] != "")) {
|
||||||
|
|
||||||
$new_parent = true;
|
$new_parent = true;
|
||||||
|
|
||||||
|
@ -1127,7 +1144,7 @@ class ostatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The item we are having on the system is the one that we wanted to store via the item array
|
// The item we are having on the system is the one that we wanted to store via the item array
|
||||||
if (isset($item["uri"]) AND ($item["uri"] == $existing_message["uri"])) {
|
if (isset($item["uri"]) && ($item["uri"] == $existing_message["uri"])) {
|
||||||
$item = array();
|
$item = array();
|
||||||
$item_stored = 0;
|
$item_stored = 0;
|
||||||
}
|
}
|
||||||
|
@ -1147,7 +1164,7 @@ class ostatus {
|
||||||
$details = self::get_actor_details($actor, $uid, $parent["contact-id"]);
|
$details = self::get_actor_details($actor, $uid, $parent["contact-id"]);
|
||||||
|
|
||||||
// Do we only want to import threads that were started by our contacts?
|
// Do we only want to import threads that were started by our contacts?
|
||||||
if ($details["not_following"] AND $new_parent AND get_config('system','ostatus_full_threads')) {
|
if ($details["not_following"] && $new_parent && get_config('system','ostatus_full_threads')) {
|
||||||
logger("Don't import uri ".$first_id." because user ".$uid." doesn't follow the person ".$actor, LOGGER_DEBUG);
|
logger("Don't import uri ".$first_id." because user ".$uid." doesn't follow the person ".$actor, LOGGER_DEBUG);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1201,46 +1218,56 @@ class ostatus {
|
||||||
$arr["coord"] = trim($single_conv->location->lat." ".$single_conv->location->lon);
|
$arr["coord"] = trim($single_conv->location->lat." ".$single_conv->location->lon);
|
||||||
|
|
||||||
// Is it a reshared item?
|
// Is it a reshared item?
|
||||||
if (isset($single_conv->verb) AND ($single_conv->verb == "share") AND isset($single_conv->object)) {
|
if (isset($single_conv->verb) && ($single_conv->verb == "share") && isset($single_conv->object)) {
|
||||||
if (is_array($single_conv->object))
|
if (is_array($single_conv->object))
|
||||||
$single_conv->object = $single_conv->object[0];
|
$single_conv->object = $single_conv->object[0];
|
||||||
|
|
||||||
logger("Found reshared item ".$single_conv->object->id);
|
// Sometimes GNU Social doesn't returns a complete object
|
||||||
|
if (!isset($single_conv->object->actor->url)) {
|
||||||
// $single_conv->object->context->conversation;
|
$object = self::shared_object($single_conv->object->id, $conversation);
|
||||||
|
if (is_object($object)) {
|
||||||
if (isset($single_conv->object->object->id))
|
$single_conv->object = $object;
|
||||||
$arr["uri"] = $single_conv->object->object->id;
|
}
|
||||||
else
|
|
||||||
$arr["uri"] = $single_conv->object->id;
|
|
||||||
|
|
||||||
if (isset($single_conv->object->object->url))
|
|
||||||
$plink = self::convert_href($single_conv->object->object->url);
|
|
||||||
else
|
|
||||||
$plink = self::convert_href($single_conv->object->url);
|
|
||||||
|
|
||||||
if (isset($single_conv->object->object->content))
|
|
||||||
$arr["body"] = add_page_info_to_body(html2bbcode($single_conv->object->object->content));
|
|
||||||
else
|
|
||||||
$arr["body"] = add_page_info_to_body(html2bbcode($single_conv->object->content));
|
|
||||||
|
|
||||||
$arr["plink"] = $plink;
|
|
||||||
|
|
||||||
$arr["created"] = $single_conv->object->published;
|
|
||||||
$arr["edited"] = $single_conv->object->published;
|
|
||||||
|
|
||||||
$arr["author-name"] = $single_conv->object->actor->displayName;
|
|
||||||
if ($arr["owner-name"] == '') {
|
|
||||||
$arr["author-name"] = $single_conv->object->actor->contact->displayName;
|
|
||||||
}
|
}
|
||||||
$arr["author-link"] = $single_conv->object->actor->url;
|
|
||||||
$arr["author-avatar"] = Probe::fixAvatar($single_conv->object->actor->image->url, $arr["author-link"]);
|
|
||||||
|
|
||||||
$arr["app"] = $single_conv->object->provider->displayName."#";
|
if (isset($single_conv->object->actor->url)) {
|
||||||
//$arr["verb"] = $single_conv->object->verb;
|
logger("Found reshared item ".$single_conv->object->id);
|
||||||
|
|
||||||
$arr["location"] = $single_conv->object->location->displayName;
|
// $single_conv->object->context->conversation;
|
||||||
$arr["coord"] = trim($single_conv->object->location->lat." ".$single_conv->object->location->lon);
|
|
||||||
|
if (isset($single_conv->object->object->id)) {
|
||||||
|
$arr["uri"] = $single_conv->object->object->id;
|
||||||
|
} else {
|
||||||
|
$arr["uri"] = $single_conv->object->id;
|
||||||
|
}
|
||||||
|
if (isset($single_conv->object->object->url)) {
|
||||||
|
$plink = self::convert_href($single_conv->object->object->url);
|
||||||
|
} else {
|
||||||
|
$plink = self::convert_href($single_conv->object->url);
|
||||||
|
}
|
||||||
|
if (isset($single_conv->object->object->content)) {
|
||||||
|
$arr["body"] = add_page_info_to_body(html2bbcode($single_conv->object->object->content));
|
||||||
|
} else {
|
||||||
|
$arr["body"] = add_page_info_to_body(html2bbcode($single_conv->object->content));
|
||||||
|
}
|
||||||
|
$arr["plink"] = $plink;
|
||||||
|
|
||||||
|
$arr["created"] = $single_conv->object->published;
|
||||||
|
$arr["edited"] = $single_conv->object->published;
|
||||||
|
|
||||||
|
$arr["author-name"] = $single_conv->object->actor->displayName;
|
||||||
|
if ($arr["owner-name"] == '') {
|
||||||
|
$arr["author-name"] = $single_conv->object->actor->contact->displayName;
|
||||||
|
}
|
||||||
|
$arr["author-link"] = $single_conv->object->actor->url;
|
||||||
|
$arr["author-avatar"] = Probe::fixAvatar($single_conv->object->actor->image->url, $arr["author-link"]);
|
||||||
|
|
||||||
|
$arr["app"] = $single_conv->object->provider->displayName."#";
|
||||||
|
//$arr["verb"] = $single_conv->object->verb;
|
||||||
|
|
||||||
|
$arr["location"] = $single_conv->object->location->displayName;
|
||||||
|
$arr["coord"] = trim($single_conv->object->location->lat." ".$single_conv->object->location->lon);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($arr["location"] == "")
|
if ($arr["location"] == "")
|
||||||
|
@ -1250,27 +1277,20 @@ class ostatus {
|
||||||
unset($arr["coord"]);
|
unset($arr["coord"]);
|
||||||
|
|
||||||
// Copy fields from given item array
|
// Copy fields from given item array
|
||||||
if (isset($item["uri"]) AND (($item["uri"] == $arr["uri"]) OR ($item["uri"] == $single_conv->id))) {
|
if (isset($item["uri"]) && (($item["uri"] == $arr["uri"]) || ($item["uri"] == $single_conv->id))) {
|
||||||
$copy_fields = array("owner-name", "owner-link", "owner-avatar", "author-name", "author-link", "author-avatar",
|
logger('Use stored item array for item with URI '.$item["uri"], LOGGER_DEBUG);
|
||||||
"gravity", "body", "object-type", "object", "verb", "created", "edited", "coord", "tag",
|
$newitem = item_store($item);
|
||||||
"title", "attach", "app", "type", "location", "contact-id", "uri");
|
$item = array();
|
||||||
foreach ($copy_fields AS $field)
|
$item_stored = $newitem;
|
||||||
if (isset($item[$field]))
|
} else {
|
||||||
$arr[$field] = $item[$field];
|
$newitem = item_store($arr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$newitem = item_store($arr);
|
|
||||||
if (!$newitem) {
|
if (!$newitem) {
|
||||||
logger("Item wasn't stored ".print_r($arr, true), LOGGER_DEBUG);
|
logger("Item wasn't stored ".print_r($arr, true), LOGGER_DEBUG);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($item["uri"]) AND ($item["uri"] == $arr["uri"])) {
|
|
||||||
$item = array();
|
|
||||||
$item_stored = $newitem;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger('Stored new item '.$plink.' for parent '.$arr["parent-uri"].' under id '.$newitem, LOGGER_DEBUG);
|
logger('Stored new item '.$plink.' for parent '.$arr["parent-uri"].' under id '.$newitem, LOGGER_DEBUG);
|
||||||
|
|
||||||
// Add the conversation entry (but don't fetch the whole conversation)
|
// Add the conversation entry (but don't fetch the whole conversation)
|
||||||
|
@ -1287,7 +1307,7 @@ class ostatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($item_stored < 0) AND (count($item) > 0)) {
|
if (($item_stored < 0) && (count($item) > 0)) {
|
||||||
|
|
||||||
if (get_config('system','ostatus_full_threads')) {
|
if (get_config('system','ostatus_full_threads')) {
|
||||||
$details = self::get_actor_details($item["owner-link"], $uid, $item["contact-id"]);
|
$details = self::get_actor_details($item["owner-link"], $uid, $item["contact-id"]);
|
||||||
|
@ -1523,7 +1543,7 @@ class ostatus {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($siteinfo["type"] != "photo") AND isset($siteinfo["image"])) {
|
if (($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
|
||||||
$imgdata = get_photo_info($siteinfo["image"]);
|
$imgdata = get_photo_info($siteinfo["image"]);
|
||||||
$attributes = array("rel" => "enclosure",
|
$attributes = array("rel" => "enclosure",
|
||||||
"href" => $siteinfo["image"],
|
"href" => $siteinfo["image"],
|
||||||
|
@ -1768,7 +1788,7 @@ class ostatus {
|
||||||
*/
|
*/
|
||||||
private function reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel) {
|
private function reshare_entry($doc, $item, $owner, $repeated_guid, $toplevel) {
|
||||||
|
|
||||||
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1834,7 +1854,7 @@ class ostatus {
|
||||||
*/
|
*/
|
||||||
private function like_entry($doc, $item, $owner, $toplevel) {
|
private function like_entry($doc, $item, $owner, $toplevel) {
|
||||||
|
|
||||||
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1979,7 +1999,7 @@ class ostatus {
|
||||||
*/
|
*/
|
||||||
private function note_entry($doc, $item, $owner, $toplevel) {
|
private function note_entry($doc, $item, $owner, $toplevel) {
|
||||||
|
|
||||||
if (($item["id"] != $item["parent"]) AND (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
if (($item["id"] != $item["parent"]) && (normalise_link($item["author-link"]) != normalise_link($owner["url"]))) {
|
||||||
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
logger("OStatus entry is from author ".$owner["url"]." - not from ".$item["author-link"].". Quitting.", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2060,7 +2080,7 @@ class ostatus {
|
||||||
xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
|
xml::add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
|
||||||
"href" => App::get_baseurl()."/display/".$item["guid"]));
|
"href" => App::get_baseurl()."/display/".$item["guid"]));
|
||||||
|
|
||||||
if ($complete AND ($item["id"] > 0))
|
if ($complete && ($item["id"] > 0))
|
||||||
xml::add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"]));
|
xml::add_element($doc, $entry, "status_net", "", array("notice_id" => $item["id"]));
|
||||||
|
|
||||||
xml::add_element($doc, $entry, "activity:verb", $verb);
|
xml::add_element($doc, $entry, "activity:verb", $verb);
|
||||||
|
@ -2082,7 +2102,7 @@ class ostatus {
|
||||||
|
|
||||||
$mentioned = array();
|
$mentioned = array();
|
||||||
|
|
||||||
if (($item['parent'] != $item['id']) OR ($item['parent-uri'] !== $item['uri']) OR (($item['thr-parent'] !== '') AND ($item['thr-parent'] !== $item['uri']))) {
|
if (($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
|
||||||
$parent = q("SELECT `guid`, `author-link`, `owner-link` FROM `item` WHERE `id` = %d", intval($item["parent"]));
|
$parent = q("SELECT `guid`, `author-link`, `owner-link` FROM `item` WHERE `id` = %d", intval($item["parent"]));
|
||||||
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
$parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
|
||||||
|
|
||||||
|
@ -2155,7 +2175,7 @@ class ostatus {
|
||||||
$r = q("SELECT `forum`, `prv` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'",
|
$r = q("SELECT `forum`, `prv` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'",
|
||||||
intval($owner["uid"]),
|
intval($owner["uid"]),
|
||||||
dbesc(normalise_link($mention)));
|
dbesc(normalise_link($mention)));
|
||||||
if ($r[0]["forum"] OR $r[0]["prv"])
|
if ($r[0]["forum"] || $r[0]["prv"])
|
||||||
xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
|
xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
|
||||||
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
|
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
|
||||||
"href" => $mention));
|
"href" => $mention));
|
||||||
|
@ -2181,7 +2201,7 @@ class ostatus {
|
||||||
|
|
||||||
self::get_attachment($doc, $entry, $item);
|
self::get_attachment($doc, $entry, $item);
|
||||||
|
|
||||||
if ($complete AND ($item["id"] > 0)) {
|
if ($complete && ($item["id"] > 0)) {
|
||||||
$app = $item["app"];
|
$app = $item["app"];
|
||||||
if ($app == "")
|
if ($app == "")
|
||||||
$app = "web";
|
$app = "web";
|
||||||
|
|
|
@ -12,7 +12,7 @@ function getGps($exifCoord, $hemi) {
|
||||||
$minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
|
$minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
|
||||||
$seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0;
|
$seconds = count($exifCoord) > 2 ? gps2Num($exifCoord[2]) : 0;
|
||||||
|
|
||||||
$flip = ($hemi == 'W' or $hemi == 'S') ? -1 : 1;
|
$flip = ($hemi == 'W' || $hemi == 'S') ? -1 : 1;
|
||||||
|
|
||||||
return floatval($flip * ($degrees + ($minutes / 60) + ($seconds / 3600)));
|
return floatval($flip * ($degrees + ($minutes / 60) + ($seconds / 3600)));
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ function photo_albums($uid, $update = false) {
|
||||||
|
|
||||||
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
|
$key = "photo_albums:".$uid.":".local_user().":".remote_user();
|
||||||
$albums = Cache::get($key);
|
$albums = Cache::get($key);
|
||||||
if (is_null($albums) OR $update) {
|
if (is_null($albums) || $update) {
|
||||||
if (!Config::get('system', 'no_count', false)) {
|
if (!Config::get('system', 'no_count', false)) {
|
||||||
/// @todo This query needs to be renewed. It is really slow
|
/// @todo This query needs to be renewed. It is really slow
|
||||||
// At this time we just store the data in the cache
|
// At this time we just store the data in the cache
|
||||||
|
|
|
@ -8,7 +8,7 @@ class pidfile {
|
||||||
|
|
||||||
if (file_exists($this->_file)) {
|
if (file_exists($this->_file)) {
|
||||||
$pid = trim(@file_get_contents($this->_file));
|
$pid = trim(@file_get_contents($this->_file));
|
||||||
if (($pid != "") AND posix_kill($pid, 0)) {
|
if (($pid != "") && posix_kill($pid, 0)) {
|
||||||
$this->_running = true;
|
$this->_running = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ function get_old_attachment_data($body) {
|
||||||
|
|
||||||
$picturedata = get_photo_info($matches[1]);
|
$picturedata = get_photo_info($matches[1]);
|
||||||
|
|
||||||
if (($picturedata[0] >= 500) AND ($picturedata[0] >= $picturedata[1]))
|
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1]))
|
||||||
$post["image"] = $matches[1];
|
$post["image"] = $matches[1];
|
||||||
else
|
else
|
||||||
$post["preview"] = $matches[1];
|
$post["preview"] = $matches[1];
|
||||||
|
@ -64,8 +64,8 @@ function get_old_attachment_data($body) {
|
||||||
$post["url"] = $matches[1];
|
$post["url"] = $matches[1];
|
||||||
$post["title"] = $matches[2];
|
$post["title"] = $matches[2];
|
||||||
}
|
}
|
||||||
if (($post["url"] == "") AND (in_array($post["type"], array("link", "video")))
|
if (($post["url"] == "") && (in_array($post["type"], array("link", "video")))
|
||||||
AND preg_match("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $attacheddata, $matches)) {
|
&& preg_match("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $attacheddata, $matches)) {
|
||||||
$post["url"] = $matches[1];
|
$post["url"] = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ function get_attached_data($body) {
|
||||||
// Workaround:
|
// Workaround:
|
||||||
// Sometimes photo posts to the own album are not detected at the start.
|
// Sometimes photo posts to the own album are not detected at the start.
|
||||||
// So we seem to cannot use the cache for these cases. That's strange.
|
// So we seem to cannot use the cache for these cases. That's strange.
|
||||||
if (($data["type"] != "photo") AND strstr($pictures[0][1], "/photos/"))
|
if (($data["type"] != "photo") && strstr($pictures[0][1], "/photos/"))
|
||||||
$data = ParseUrl::getSiteinfo($pictures[0][1], true);
|
$data = ParseUrl::getSiteinfo($pictures[0][1], true);
|
||||||
|
|
||||||
if ($data["type"] == "photo") {
|
if ($data["type"] == "photo") {
|
||||||
|
@ -256,7 +256,7 @@ function get_attached_data($body) {
|
||||||
$post["type"] = "text";
|
$post["type"] = "text";
|
||||||
$post["text"] = trim($body);
|
$post["text"] = trim($body);
|
||||||
}
|
}
|
||||||
} elseif (isset($post["url"]) AND ($post["type"] == "video")) {
|
} elseif (isset($post["url"]) && ($post["type"] == "video")) {
|
||||||
$data = ParseUrl::getSiteinfoCached($post["url"], true);
|
$data = ParseUrl::getSiteinfoCached($post["url"], true);
|
||||||
|
|
||||||
if (isset($data["images"][0]))
|
if (isset($data["images"][0]))
|
||||||
|
@ -278,7 +278,7 @@ function shortenmsg($msg, $limit, $twitter = false) {
|
||||||
if (iconv_strlen(trim($msg."\n".$line), "UTF-8") <= $limit)
|
if (iconv_strlen(trim($msg."\n".$line), "UTF-8") <= $limit)
|
||||||
$msg = trim($msg."\n".$line);
|
$msg = trim($msg."\n".$line);
|
||||||
// Is the new message empty by now or is it a reshared message?
|
// Is the new message empty by now or is it a reshared message?
|
||||||
elseif (($msg == "") OR (($row == 1) AND (substr($msg, 0, 4) == $recycle)))
|
elseif (($msg == "") || (($row == 1) && (substr($msg, 0, 4) == $recycle)))
|
||||||
$msg = iconv_substr(iconv_substr(trim($msg."\n".$line), 0, $limit, "UTF-8"), 0, -3, "UTF-8").$ellipsis;
|
$msg = iconv_substr(iconv_substr(trim($msg."\n".$line), 0, $limit, "UTF-8"), 0, -3, "UTF-8").$ellipsis;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@ -315,7 +315,7 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
|
||||||
//$post = get_attached_data($b["body"]);
|
//$post = get_attached_data($b["body"]);
|
||||||
$post = get_attached_data($body);
|
$post = get_attached_data($body);
|
||||||
|
|
||||||
if (($b["title"] != "") AND ($post["text"] != ""))
|
if (($b["title"] != "") && ($post["text"] != ""))
|
||||||
$post["text"] = trim($b["title"]."\n\n".$post["text"]);
|
$post["text"] = trim($b["title"]."\n\n".$post["text"]);
|
||||||
elseif ($b["title"] != "")
|
elseif ($b["title"] != "")
|
||||||
$post["text"] = trim($b["title"]);
|
$post["text"] = trim($b["title"]);
|
||||||
|
@ -329,7 +329,7 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
|
||||||
|
|
||||||
// If we post to a network with no limit we only fetch
|
// If we post to a network with no limit we only fetch
|
||||||
// an abstract exactly for this network
|
// an abstract exactly for this network
|
||||||
if (($limit == 0) AND ($abstract == $default_abstract))
|
if (($limit == 0) && ($abstract == $default_abstract))
|
||||||
$abstract = "";
|
$abstract = "";
|
||||||
|
|
||||||
} else // Try to guess the correct target network
|
} else // Try to guess the correct target network
|
||||||
|
@ -373,25 +373,25 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
|
||||||
elseif ($post["type"] == "photo")
|
elseif ($post["type"] == "photo")
|
||||||
$link = $post["image"];
|
$link = $post["image"];
|
||||||
|
|
||||||
if (($msg == "") AND isset($post["title"]))
|
if (($msg == "") && isset($post["title"]))
|
||||||
$msg = trim($post["title"]);
|
$msg = trim($post["title"]);
|
||||||
|
|
||||||
if (($msg == "") AND isset($post["description"]))
|
if (($msg == "") && isset($post["description"]))
|
||||||
$msg = trim($post["description"]);
|
$msg = trim($post["description"]);
|
||||||
|
|
||||||
// If the link is already contained in the post, then it neeedn't to be added again
|
// If the link is already contained in the post, then it neeedn't to be added again
|
||||||
// But: if the link is beyond the limit, then it has to be added.
|
// But: if the link is beyond the limit, then it has to be added.
|
||||||
if (($link != "") AND strstr($msg, $link)) {
|
if (($link != "") && strstr($msg, $link)) {
|
||||||
$pos = strpos($msg, $link);
|
$pos = strpos($msg, $link);
|
||||||
|
|
||||||
// Will the text be shortened in the link?
|
// Will the text be shortened in the link?
|
||||||
// Or is the link the last item in the post?
|
// Or is the link the last item in the post?
|
||||||
if (($limit > 0) AND ($pos < $limit) AND (($pos + 23 > $limit) OR ($pos + strlen($link) == strlen($msg))))
|
if (($limit > 0) && ($pos < $limit) && (($pos + 23 > $limit) || ($pos + strlen($link) == strlen($msg))))
|
||||||
$msg = trim(str_replace($link, "", $msg));
|
$msg = trim(str_replace($link, "", $msg));
|
||||||
elseif (($limit == 0) OR ($pos < $limit)) {
|
elseif (($limit == 0) || ($pos < $limit)) {
|
||||||
// The limit has to be increased since it will be shortened - but not now
|
// The limit has to be increased since it will be shortened - but not now
|
||||||
// Only do it with Twitter (htmlmode = 8)
|
// Only do it with Twitter (htmlmode = 8)
|
||||||
if (($limit > 0) AND (strlen($link) > 23) AND ($htmlmode == 8))
|
if (($limit > 0) && (strlen($link) > 23) && ($htmlmode == 8))
|
||||||
$limit = $limit - 23 + strlen($link);
|
$limit = $limit - 23 + strlen($link);
|
||||||
|
|
||||||
$link = "";
|
$link = "";
|
||||||
|
@ -414,7 +414,7 @@ function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2
|
||||||
|
|
||||||
if (iconv_strlen($msg, "UTF-8") > $limit) {
|
if (iconv_strlen($msg, "UTF-8") > $limit) {
|
||||||
|
|
||||||
if (($post["type"] == "text") AND isset($post["url"]))
|
if (($post["type"] == "text") && isset($post["url"]))
|
||||||
$post["url"] = $b["plink"];
|
$post["url"] = $b["plink"];
|
||||||
elseif (!isset($post["url"])) {
|
elseif (!isset($post["url"])) {
|
||||||
$limit = $limit - 23;
|
$limit = $limit - 23;
|
||||||
|
|
|
@ -563,7 +563,7 @@ function theme_include($file, $root = '') {
|
||||||
$root = $root . '/';
|
$root = $root . '/';
|
||||||
}
|
}
|
||||||
$theme_info = $a->theme_info;
|
$theme_info = $a->theme_info;
|
||||||
if (is_array($theme_info) AND array_key_exists('extends',$theme_info)) {
|
if (is_array($theme_info) && array_key_exists('extends',$theme_info)) {
|
||||||
$parent = $theme_info['extends'];
|
$parent = $theme_info['extends'];
|
||||||
} else {
|
} else {
|
||||||
$parent = 'NOPATH';
|
$parent = 'NOPATH';
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Util\Lock;
|
||||||
|
|
||||||
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
|
if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||||
$directory = dirname($_SERVER["argv"][0]);
|
$directory = dirname($_SERVER["argv"][0]);
|
||||||
|
|
||||||
if (substr($directory, 0, 1) != "/")
|
if (substr($directory, 0, 1) != "/") {
|
||||||
$directory = $_SERVER["PWD"]."/".$directory;
|
$directory = $_SERVER["PWD"]."/".$directory;
|
||||||
|
}
|
||||||
$directory = realpath($directory."/..");
|
$directory = realpath($directory."/..");
|
||||||
|
|
||||||
chdir($directory);
|
chdir($directory);
|
||||||
|
@ -19,16 +20,12 @@ require_once("boot.php");
|
||||||
function poller_run($argv, $argc){
|
function poller_run($argv, $argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
if (is_null($a)) {
|
$a = new App(dirname(__DIR__));
|
||||||
$a = new App(dirname(__DIR__));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_null($db)) {
|
@include(".htconfig.php");
|
||||||
@include(".htconfig.php");
|
require_once("include/dba.php");
|
||||||
require_once("include/dba.php");
|
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
||||||
$db = new dba($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
};
|
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
|
@ -41,56 +38,86 @@ function poller_run($argv, $argc){
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
|
// At first check the maximum load. We shouldn't continue with a high load
|
||||||
|
if ($a->maxload_reached()) {
|
||||||
|
logger('Pre check: maximum load reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We now start the process. This is done after the load check since this could increase the load.
|
||||||
$a->start_process();
|
$a->start_process();
|
||||||
|
|
||||||
if ($a->min_memory_reached()) {
|
// At first we check the number of workers and quit if there are too much of them
|
||||||
return;
|
// This is done at the top to avoid that too much code is executed without a need to do so,
|
||||||
}
|
// since the poller mostly quits here.
|
||||||
|
|
||||||
if (poller_max_connections_reached()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($a->maxload_reached()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($argc <= 1) OR ($argv[1] != "no_cron")) {
|
|
||||||
poller_run_cron();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($a->max_processes_reached()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Checking the number of workers
|
|
||||||
if (poller_too_much_workers()) {
|
if (poller_too_much_workers()) {
|
||||||
poller_kill_stale_workers();
|
poller_kill_stale_workers();
|
||||||
|
logger('Pre check: Active worker limit reached, quitting.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do we have too few memory?
|
||||||
|
if ($a->min_memory_reached()) {
|
||||||
|
logger('Pre check: Memory limit reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possibly there are too much database connections
|
||||||
|
if (poller_max_connections_reached()) {
|
||||||
|
logger('Pre check: maximum connections reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Possibly there are too much database processes that block the system
|
||||||
|
if ($a->max_processes_reached()) {
|
||||||
|
logger('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now we start additional cron processes if we should do so
|
||||||
|
if (($argc <= 1) || ($argv[1] != "no_cron")) {
|
||||||
|
poller_run_cron();
|
||||||
|
}
|
||||||
|
|
||||||
$starttime = time();
|
$starttime = time();
|
||||||
|
|
||||||
|
// We fetch the next queue entry that is about to be executed
|
||||||
while ($r = poller_worker_process()) {
|
while ($r = poller_worker_process()) {
|
||||||
|
|
||||||
// Check free memory
|
// If we got that queue entry we claim it for us
|
||||||
if ($a->min_memory_reached()) {
|
if (!poller_claim_process($r[0])) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count active workers and compare them with a maximum value that depends on the load
|
// To avoid the quitting of multiple pollers only one poller at a time will execute the check
|
||||||
if (poller_too_much_workers()) {
|
if (Lock::set('poller_worker', 0)) {
|
||||||
return;
|
// Count active workers and compare them with a maximum value that depends on the load
|
||||||
|
if (poller_too_much_workers()) {
|
||||||
|
logger('Active worker limit reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check free memory
|
||||||
|
if ($a->min_memory_reached()) {
|
||||||
|
logger('Memory limit reached, quitting.', LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Lock::remove('poller_worker');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// finally the work will be done
|
||||||
if (!poller_execute($r[0])) {
|
if (!poller_execute($r[0])) {
|
||||||
|
logger('Process execution failed, quitting.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quit the poller once every hour
|
// Quit the poller once every hour
|
||||||
if (time() > ($starttime + 3600))
|
if (time() > ($starttime + 3600)) {
|
||||||
|
logger('Process lifetime reached, quitting.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
logger("Couldn't select a workerqueue entry, quitting.", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,43 +135,22 @@ function poller_execute($queue) {
|
||||||
|
|
||||||
// Quit when in maintenance
|
// Quit when in maintenance
|
||||||
if (Config::get('system', 'maintenance', true)) {
|
if (Config::get('system', 'maintenance', true)) {
|
||||||
|
logger("Maintenance mode - quit process ".$mypid, LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constantly check the number of parallel database processes
|
// Constantly check the number of parallel database processes
|
||||||
if ($a->max_processes_reached()) {
|
if ($a->max_processes_reached()) {
|
||||||
|
logger("Max processes reached for process ".$mypid, LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constantly check the number of available database connections to let the frontend be accessible at any time
|
// Constantly check the number of available database connections to let the frontend be accessible at any time
|
||||||
if (poller_max_connections_reached()) {
|
if (poller_max_connections_reached()) {
|
||||||
|
logger("Max connection reached for process ".$mypid, LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dba::update('workerqueue', array('executed' => datetime_convert(), 'pid' => $mypid),
|
|
||||||
array('id' => $queue["id"], 'pid' => 0))) {
|
|
||||||
logger("Couldn't update queue entry ".$queue["id"]." - skip this execution", LOGGER_DEBUG);
|
|
||||||
dba::commit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Assure that there are no tasks executed twice
|
|
||||||
$id = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
|
|
||||||
if (!$id) {
|
|
||||||
logger("Queue item ".$queue["id"]." vanished - skip this execution", LOGGER_DEBUG);
|
|
||||||
dba::commit();
|
|
||||||
return true;
|
|
||||||
} elseif ((strtotime($id[0]["executed"]) <= 0) OR ($id[0]["pid"] == 0)) {
|
|
||||||
logger("Entry for queue item ".$queue["id"]." wasn't stored - skip this execution", LOGGER_DEBUG);
|
|
||||||
dba::commit();
|
|
||||||
return true;
|
|
||||||
} elseif ($id[0]["pid"] != $mypid) {
|
|
||||||
logger("Queue item ".$queue["id"]." is to be executed by process ".$id[0]["pid"]." and not by me (".$mypid.") - skip this execution", LOGGER_DEBUG);
|
|
||||||
dba::commit();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
dba::commit();
|
|
||||||
|
|
||||||
$argv = json_decode($queue["parameter"]);
|
$argv = json_decode($queue["parameter"]);
|
||||||
|
|
||||||
// Check for existance and validity of the include file
|
// Check for existance and validity of the include file
|
||||||
|
@ -161,9 +167,7 @@ function poller_execute($queue) {
|
||||||
$funcname = str_replace(".php", "", basename($argv[0]))."_run";
|
$funcname = str_replace(".php", "", basename($argv[0]))."_run";
|
||||||
|
|
||||||
if (function_exists($funcname)) {
|
if (function_exists($funcname)) {
|
||||||
|
|
||||||
poller_exec_function($queue, $funcname, $argv);
|
poller_exec_function($queue, $funcname, $argv);
|
||||||
|
|
||||||
dba::delete('workerqueue', array('id' => $queue["id"]));
|
dba::delete('workerqueue', array('id' => $queue["id"]));
|
||||||
} else {
|
} else {
|
||||||
logger("Function ".$funcname." does not exist");
|
logger("Function ".$funcname." does not exist");
|
||||||
|
@ -238,24 +242,27 @@ function poller_exec_function($queue, $funcname, $argv) {
|
||||||
$o = "\nDatabase Read:\n";
|
$o = "\nDatabase Read:\n";
|
||||||
foreach ($a->callstack["database"] AS $func => $time) {
|
foreach ($a->callstack["database"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0) {
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a->callstack["database_write"])) {
|
if (isset($a->callstack["database_write"])) {
|
||||||
$o .= "\nDatabase Write:\n";
|
$o .= "\nDatabase Write:\n";
|
||||||
foreach ($a->callstack["database_write"] AS $func => $time) {
|
foreach ($a->callstack["database_write"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0) {
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($a->callstack["network"])) {
|
if (isset($a->callstack["network"])) {
|
||||||
$o .= "\nNetwork:\n";
|
$o .= "\nNetwork:\n";
|
||||||
foreach ($a->callstack["network"] AS $func => $time) {
|
foreach ($a->callstack["network"] AS $func => $time) {
|
||||||
$time = round($time, 3);
|
$time = round($time, 3);
|
||||||
if ($time > 0)
|
if ($time > 0) {
|
||||||
$o .= $func.": ".$time."\n";
|
$o .= $func.": ".$time."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,27 +303,30 @@ function poller_max_connections_reached() {
|
||||||
if ($max == 0) {
|
if ($max == 0) {
|
||||||
// the maximum number of possible user connections can be a system variable
|
// the maximum number of possible user connections can be a system variable
|
||||||
$r = q("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
|
$r = q("SHOW VARIABLES WHERE `variable_name` = 'max_user_connections'");
|
||||||
if ($r)
|
if (dbm::is_result($r)) {
|
||||||
$max = $r[0]["Value"];
|
$max = $r[0]["Value"];
|
||||||
|
}
|
||||||
// Or it can be granted. This overrides the system variable
|
// Or it can be granted. This overrides the system variable
|
||||||
$r = q("SHOW GRANTS");
|
$r = q("SHOW GRANTS");
|
||||||
if ($r)
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r AS $grants) {
|
foreach ($r AS $grants) {
|
||||||
$grant = array_pop($grants);
|
$grant = array_pop($grants);
|
||||||
if (stristr($grant, "GRANT USAGE ON"))
|
if (stristr($grant, "GRANT USAGE ON")) {
|
||||||
if (preg_match("/WITH MAX_USER_CONNECTIONS (\d*)/", $grant, $match))
|
if (preg_match("/WITH MAX_USER_CONNECTIONS (\d*)/", $grant, $match)) {
|
||||||
$max = $match[1];
|
$max = $match[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If $max is set we will use the processlist to determine the current number of connections
|
// If $max is set we will use the processlist to determine the current number of connections
|
||||||
// The processlist only shows entries of the current user
|
// The processlist only shows entries of the current user
|
||||||
if ($max != 0) {
|
if ($max != 0) {
|
||||||
$r = q("SHOW PROCESSLIST");
|
$r = q("SHOW PROCESSLIST");
|
||||||
if (!dbm::is_result($r))
|
if (!dbm::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
$used = count($r);
|
$used = count($r);
|
||||||
|
|
||||||
logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
|
logger("Connection usage (user values): ".$used."/".$max, LOGGER_DEBUG);
|
||||||
|
@ -332,28 +342,28 @@ function poller_max_connections_reached() {
|
||||||
// We will now check for the system values.
|
// We will now check for the system values.
|
||||||
// This limit could be reached although the user limits are fine.
|
// This limit could be reached although the user limits are fine.
|
||||||
$r = q("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
|
$r = q("SHOW VARIABLES WHERE `variable_name` = 'max_connections'");
|
||||||
if (!$r)
|
if (!dbm::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
$max = intval($r[0]["Value"]);
|
$max = intval($r[0]["Value"]);
|
||||||
if ($max == 0)
|
if ($max == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
$r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
$r = q("SHOW STATUS WHERE `variable_name` = 'Threads_connected'");
|
||||||
if (!$r)
|
if (!dbm::is_result($r)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
$used = intval($r[0]["Value"]);
|
$used = intval($r[0]["Value"]);
|
||||||
if ($used == 0)
|
if ($used == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
logger("Connection usage (system values): ".$used."/".$max, LOGGER_DEBUG);
|
logger("Connection usage (system values): ".$used."/".$max, LOGGER_DEBUG);
|
||||||
|
|
||||||
$level = $used / $max * 100;
|
$level = $used / $max * 100;
|
||||||
|
|
||||||
if ($level < $maxlevel)
|
if ($level < $maxlevel) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
logger("Maximum level (".$level."%) of system connections reached: ".$used."/".$max);
|
logger("Maximum level (".$level."%) of system connections reached: ".$used."/".$max);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -432,10 +442,32 @@ function poller_too_much_workers() {
|
||||||
$slope = $maxworkers / pow($maxsysload, $exponent);
|
$slope = $maxworkers / pow($maxsysload, $exponent);
|
||||||
$queues = ceil($slope * pow(max(0, $maxsysload - $load), $exponent));
|
$queues = ceil($slope * pow(max(0, $maxsysload - $load), $exponent));
|
||||||
|
|
||||||
|
// Create a list of queue entries grouped by their priority
|
||||||
|
$listitem = array();
|
||||||
|
|
||||||
|
// Adding all processes with no workerqueue entry
|
||||||
|
$processes = dba::p("SELECT COUNT(*) AS `running` FROM `process` WHERE NOT EXISTS (SELECT id FROM `workerqueue` WHERE `workerqueue`.`pid` = `process`.`pid`)");
|
||||||
|
if ($process = dba::fetch($processes)) {
|
||||||
|
$listitem[0] = "0:".$process["running"];
|
||||||
|
}
|
||||||
|
dba::close($processes);
|
||||||
|
|
||||||
|
// Now adding all processes with workerqueue entries
|
||||||
|
$entries = dba::p("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` GROUP BY `priority`");
|
||||||
|
while ($entry = dba::fetch($entries)) {
|
||||||
|
$processes = dba::p("SELECT COUNT(*) AS `running` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` WHERE `priority` = ?", $entry["priority"]);
|
||||||
|
if ($process = dba::fetch($processes)) {
|
||||||
|
$listitem[$entry["priority"]] = $entry["priority"].":".$process["running"]."/".$entry["entries"];
|
||||||
|
}
|
||||||
|
dba::close($processes);
|
||||||
|
}
|
||||||
|
dba::close($entries);
|
||||||
|
$processlist = ' ('.implode(', ', $listitem).')';
|
||||||
|
|
||||||
$s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE));
|
$s = q("SELECT COUNT(*) AS `total` FROM `workerqueue` WHERE `executed` <= '%s'", dbesc(NULL_DATE));
|
||||||
$entries = $s[0]["total"];
|
$entries = $s[0]["total"];
|
||||||
|
|
||||||
if (Config::get("system", "worker_fastlane", false) AND ($queues > 0) AND ($entries > 0) AND ($active >= $queues)) {
|
if (Config::get("system", "worker_fastlane", false) && ($queues > 0) && ($entries > 0) && ($active >= $queues)) {
|
||||||
$s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE));
|
$s = q("SELECT `priority` FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority` LIMIT 1", dbesc(NULL_DATE));
|
||||||
$top_priority = $s[0]["priority"];
|
$top_priority = $s[0]["priority"];
|
||||||
|
|
||||||
|
@ -443,37 +475,16 @@ function poller_too_much_workers() {
|
||||||
intval($top_priority), dbesc(NULL_DATE));
|
intval($top_priority), dbesc(NULL_DATE));
|
||||||
$high_running = dbm::is_result($s);
|
$high_running = dbm::is_result($s);
|
||||||
|
|
||||||
if (!$high_running AND ($top_priority > PRIORITY_UNDEFINED) AND ($top_priority < PRIORITY_NEGLIGIBLE)) {
|
if (!$high_running && ($top_priority > PRIORITY_UNDEFINED) && ($top_priority < PRIORITY_NEGLIGIBLE)) {
|
||||||
logger("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
|
logger("There are jobs with priority ".$top_priority." waiting but none is executed. Open a fastlane.", LOGGER_DEBUG);
|
||||||
$queues = $active + 1;
|
$queues = $active + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a list of queue entries grouped by their priority
|
logger("Load: ".$load."/".$maxsysload." - processes: ".$active."/".$entries.$processlist." - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
|
||||||
$running = array(PRIORITY_CRITICAL => 0,
|
|
||||||
PRIORITY_HIGH => 0,
|
|
||||||
PRIORITY_MEDIUM => 0,
|
|
||||||
PRIORITY_LOW => 0,
|
|
||||||
PRIORITY_NEGLIGIBLE => 0);
|
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `running`, `priority` FROM `process` INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid` GROUP BY `priority`");
|
|
||||||
if (dbm::is_result($r))
|
|
||||||
foreach ($r AS $process)
|
|
||||||
$running[$process["priority"]] = $process["running"];
|
|
||||||
|
|
||||||
$processlist = "";
|
|
||||||
$r = q("SELECT COUNT(*) AS `entries`, `priority` FROM `workerqueue` GROUP BY `priority`");
|
|
||||||
if (dbm::is_result($r))
|
|
||||||
foreach ($r as $entry) {
|
|
||||||
if ($processlist != "")
|
|
||||||
$processlist .= ", ";
|
|
||||||
$processlist .= $entry["priority"].":".$running[$entry["priority"]]."/".$entry["entries"];
|
|
||||||
}
|
|
||||||
|
|
||||||
logger("Load: ".$load."/".$maxsysload." - processes: ".$active."/".$entries." (".$processlist.") - maximum: ".$queues."/".$maxqueues, LOGGER_DEBUG);
|
|
||||||
|
|
||||||
// Are there fewer workers running as possible? Then fork a new one.
|
// Are there fewer workers running as possible? Then fork a new one.
|
||||||
if (!Config::get("system", "worker_dont_fork") AND ($queues > ($active + 1)) AND ($entries > 1)) {
|
if (!Config::get("system", "worker_dont_fork") && ($queues > ($active + 1)) && ($entries > 1)) {
|
||||||
logger("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
|
logger("Active workers: ".$active."/".$queues." Fork a new worker.", LOGGER_DEBUG);
|
||||||
$args = array("include/poller.php", "no_cron");
|
$args = array("include/poller.php", "no_cron");
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
@ -481,7 +492,7 @@ function poller_too_much_workers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return($active >= $queues);
|
return $active >= $queues;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -492,7 +503,7 @@ function poller_too_much_workers() {
|
||||||
function poller_active_workers() {
|
function poller_active_workers() {
|
||||||
$workers = q("SELECT COUNT(*) AS `processes` FROM `process` WHERE `command` = 'poller.php'");
|
$workers = q("SELECT COUNT(*) AS `processes` FROM `process` WHERE `command` = 'poller.php'");
|
||||||
|
|
||||||
return($workers[0]["processes"]);
|
return $workers[0]["processes"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -513,36 +524,37 @@ function poller_passing_slow(&$highest_priority) {
|
||||||
INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`");
|
INNER JOIN `workerqueue` ON `workerqueue`.`pid` = `process`.`pid`");
|
||||||
|
|
||||||
// No active processes at all? Fine
|
// No active processes at all? Fine
|
||||||
if (!dbm::is_result($r))
|
if (!dbm::is_result($r)) {
|
||||||
return(false);
|
return false;
|
||||||
|
}
|
||||||
$priorities = array();
|
$priorities = array();
|
||||||
foreach ($r AS $line)
|
foreach ($r AS $line) {
|
||||||
$priorities[] = $line["priority"];
|
$priorities[] = $line["priority"];
|
||||||
|
}
|
||||||
// Should not happen
|
// Should not happen
|
||||||
if (count($priorities) == 0)
|
if (count($priorities) == 0) {
|
||||||
return(false);
|
return false;
|
||||||
|
}
|
||||||
$highest_priority = min($priorities);
|
$highest_priority = min($priorities);
|
||||||
|
|
||||||
// The highest process is already the slowest one?
|
// The highest process is already the slowest one?
|
||||||
// Then we quit
|
// Then we quit
|
||||||
if ($highest_priority == PRIORITY_NEGLIGIBLE)
|
if ($highest_priority == PRIORITY_NEGLIGIBLE) {
|
||||||
return(false);
|
return false;
|
||||||
|
}
|
||||||
$high = 0;
|
$high = 0;
|
||||||
foreach ($priorities AS $priority)
|
foreach ($priorities AS $priority) {
|
||||||
if ($priority == $highest_priority)
|
if ($priority == $highest_priority) {
|
||||||
++$high;
|
++$high;
|
||||||
|
}
|
||||||
|
}
|
||||||
logger("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
|
logger("Highest priority: ".$highest_priority." Total processes: ".count($priorities)." Count high priority processes: ".$high, LOGGER_DEBUG);
|
||||||
$passing_slow = (($high/count($priorities)) > (2/3));
|
$passing_slow = (($high/count($priorities)) > (2/3));
|
||||||
|
|
||||||
if ($passing_slow)
|
if ($passing_slow) {
|
||||||
logger("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
|
logger("Passing slower processes than priority ".$highest_priority, LOGGER_DEBUG);
|
||||||
|
}
|
||||||
return($passing_slow);
|
return $passing_slow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -552,12 +564,12 @@ function poller_passing_slow(&$highest_priority) {
|
||||||
*/
|
*/
|
||||||
function poller_worker_process() {
|
function poller_worker_process() {
|
||||||
|
|
||||||
dba::transaction();
|
|
||||||
|
|
||||||
// Check if we should pass some low priority process
|
// Check if we should pass some low priority process
|
||||||
$highest_priority = 0;
|
$highest_priority = 0;
|
||||||
|
|
||||||
if (poller_passing_slow($highest_priority)) {
|
if (poller_passing_slow($highest_priority)) {
|
||||||
|
dba::lock('workerqueue');
|
||||||
|
|
||||||
// Are there waiting processes with a higher priority than the currently highest?
|
// Are there waiting processes with a higher priority than the currently highest?
|
||||||
$r = q("SELECT * FROM `workerqueue`
|
$r = q("SELECT * FROM `workerqueue`
|
||||||
WHERE `executed` <= '%s' AND `priority` < %d
|
WHERE `executed` <= '%s' AND `priority` < %d
|
||||||
|
@ -573,15 +585,72 @@ function poller_worker_process() {
|
||||||
ORDER BY `priority`, `created` LIMIT 1",
|
ORDER BY `priority`, `created` LIMIT 1",
|
||||||
dbesc(NULL_DATE),
|
dbesc(NULL_DATE),
|
||||||
intval($highest_priority));
|
intval($highest_priority));
|
||||||
|
|
||||||
|
if (dbm::is_result($r)) {
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dba::lock('workerqueue');
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is no result (or we shouldn't pass lower processes) we check without priority limit
|
// If there is no result (or we shouldn't pass lower processes) we check without priority limit
|
||||||
if (($highest_priority == 0) OR !dbm::is_result($r)) {
|
if (!dbm::is_result($r)) {
|
||||||
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
|
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We only unlock the tables here, when we got no data
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
dba::unlock();
|
||||||
|
}
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Assigns a workerqueue entry to the current process
|
||||||
|
*
|
||||||
|
* When we are sure that the table locks are working correctly, we can remove the checks from here
|
||||||
|
*
|
||||||
|
* @param array $queue Workerqueue entry
|
||||||
|
*
|
||||||
|
* @return boolean "true" if the claiming was successful
|
||||||
|
*/
|
||||||
|
function poller_claim_process($queue) {
|
||||||
|
$mypid = getmypid();
|
||||||
|
|
||||||
|
$success = dba::update('workerqueue', array('executed' => datetime_convert(), 'pid' => $mypid),
|
||||||
|
array('id' => $queue["id"], 'pid' => 0));
|
||||||
|
dba::unlock();
|
||||||
|
|
||||||
|
if (!$success) {
|
||||||
|
logger("Couldn't update queue entry ".$queue["id"]." - skip this execution", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assure that there are no tasks executed twice
|
||||||
|
$id = q("SELECT `pid`, `executed` FROM `workerqueue` WHERE `id` = %d", intval($queue["id"]));
|
||||||
|
if (!$id) {
|
||||||
|
logger("Queue item ".$queue["id"]." vanished - skip this execution", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
} elseif ((strtotime($id[0]["executed"]) <= 0) || ($id[0]["pid"] == 0)) {
|
||||||
|
logger("Entry for queue item ".$queue["id"]." wasn't stored - skip this execution", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
} elseif ($id[0]["pid"] != $mypid) {
|
||||||
|
logger("Queue item ".$queue["id"]." is to be executed by process ".$id[0]["pid"]." and not by me (".$mypid.") - skip this execution", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Removes a workerqueue entry from the current process
|
||||||
|
*/
|
||||||
|
function poller_unclaim_process() {
|
||||||
|
$mypid = getmypid();
|
||||||
|
|
||||||
|
dba::update('workerqueue', array('executed' => NULL_DATE, 'pid' => 0), array('pid' => $mypid));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Call the front end worker
|
* @brief Call the front end worker
|
||||||
*/
|
*/
|
||||||
|
@ -678,7 +747,11 @@ function poller_run_cron() {
|
||||||
if (array_search(__file__,get_included_files())===0){
|
if (array_search(__file__,get_included_files())===0){
|
||||||
poller_run($_SERVER["argv"],$_SERVER["argc"]);
|
poller_run($_SERVER["argv"],$_SERVER["argc"]);
|
||||||
|
|
||||||
|
poller_unclaim_process();
|
||||||
|
|
||||||
get_app()->end_process();
|
get_app()->end_process();
|
||||||
|
|
||||||
|
Lock::remove('poller_worker');
|
||||||
|
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ function post_update_1192() {
|
||||||
WHERE `thread`.`gcontact-id` = 0 AND
|
WHERE `thread`.`gcontact-id` = 0 AND
|
||||||
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
||||||
|
|
||||||
if ($r AND ($r[0]["total"] == 0)) {
|
if ($r && ($r[0]["total"] == 0)) {
|
||||||
set_config("system", "post_update_version", 1192);
|
set_config("system", "post_update_version", 1192);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ function post_update_1198() {
|
||||||
WHERE `thread`.`author-id` = 0 AND `thread`.`owner-id` = 0 AND
|
WHERE `thread`.`author-id` = 0 AND `thread`.`owner-id` = 0 AND
|
||||||
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
(`thread`.`uid` IN (SELECT `uid` from `user`) OR `thread`.`uid` = 0)");
|
||||||
|
|
||||||
if ($r AND ($r[0]["total"] == 0)) {
|
if ($r && ($r[0]["total"] == 0)) {
|
||||||
set_config("system", "post_update_version", 1198);
|
set_config("system", "post_update_version", 1198);
|
||||||
logger("Done", LOGGER_DEBUG);
|
logger("Done", LOGGER_DEBUG);
|
||||||
return true;
|
return true;
|
||||||
|
@ -247,7 +247,7 @@ function post_update_1206() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
foreach ($r AS $user) {
|
foreach ($r AS $user) {
|
||||||
if (!empty($user["lastitem_date"]) AND ($user["lastitem_date"] > $user["last-item"])) {
|
if (!empty($user["lastitem_date"]) && ($user["lastitem_date"] > $user["last-item"])) {
|
||||||
q("UPDATE `contact` SET `last-item` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `last-item` = '%s' WHERE `id` = %d",
|
||||||
dbesc($user["lastitem_date"]),
|
dbesc($user["lastitem_date"]),
|
||||||
intval($user["id"]));
|
intval($user["id"]));
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
require_once('include/diaspora.php');
|
require_once('include/diaspora.php');
|
||||||
|
|
||||||
function profile_change() {
|
function profile_update_run(&$argv, &$argc) {
|
||||||
Diaspora::send_profile(local_user());
|
if ($argc != 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uid = intval($argv[1]);
|
||||||
|
|
||||||
|
Diaspora::send_profile($uid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ function pubsubpublish_run(&$argv, &$argc){
|
||||||
|
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
|
logger("Publish feed to ".$rr["callback_url"], LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_HIGH, 'include/pubsubpublish.php', $rr["id"]);
|
proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'include/pubsubpublish.php', $rr["id"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ function queue_run(&$argv, &$argc) {
|
||||||
logger('queue: start');
|
logger('queue: start');
|
||||||
|
|
||||||
// Handling the pubsubhubbub requests
|
// Handling the pubsubhubbub requests
|
||||||
proc_run(PRIORITY_HIGH,'include/pubsubpublish.php');
|
proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), 'include/pubsubpublish.php');
|
||||||
|
|
||||||
$r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue`
|
$r = q("SELECT `queue`.*, `contact`.`name`, `contact`.`uid` FROM `queue`
|
||||||
INNER JOIN `contact` ON `queue`.`cid` = `contact`.`id`
|
INNER JOIN `contact` ON `queue`.`cid` = `contact`.`id`
|
||||||
|
@ -45,14 +45,14 @@ function queue_run(&$argv, &$argc) {
|
||||||
* For the first 12 hours we'll try to deliver every 15 minutes
|
* For the first 12 hours we'll try to deliver every 15 minutes
|
||||||
* After that, we'll only attempt delivery once per hour.
|
* After that, we'll only attempt delivery once per hour.
|
||||||
*/
|
*/
|
||||||
$r = q("SELECT `id` FROM `queue` WHERE ((`created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR && `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE) OR (`last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR)) ORDER BY `cid`, `created`");
|
$r = q("SELECT `id` FROM `queue` WHERE ((`created` > UTC_TIMESTAMP() - INTERVAL 12 HOUR AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE) OR (`last` < UTC_TIMESTAMP() - INTERVAL 1 HOUR)) ORDER BY `cid`, `created`");
|
||||||
|
|
||||||
call_hooks('queue_predeliver', $a, $r);
|
call_hooks('queue_predeliver', $a, $r);
|
||||||
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
foreach ($r as $q_item) {
|
foreach ($r as $q_item) {
|
||||||
logger('Call queue for id '.$q_item['id']);
|
logger('Call queue for id '.$q_item['id']);
|
||||||
proc_run(PRIORITY_LOW, "include/queue.php", $q_item['id']);
|
proc_run(array('priority' => PRIORITY_LOW, 'dont_fork' => true), "include/queue.php", $q_item['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -84,7 +84,7 @@ function queue_run(&$argv, &$argc) {
|
||||||
|
|
||||||
$dead = Cache::get($cachekey_deadguy.$c[0]['notify']);
|
$dead = Cache::get($cachekey_deadguy.$c[0]['notify']);
|
||||||
|
|
||||||
if (!is_null($dead) AND $dead) {
|
if (!is_null($dead) && $dead) {
|
||||||
logger('queue: skipping known dead url: '.$c[0]['notify']);
|
logger('queue: skipping known dead url: '.$c[0]['notify']);
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
return;
|
return;
|
||||||
|
@ -102,7 +102,7 @@ function queue_run(&$argv, &$argc) {
|
||||||
Cache::set($cachekey_server.$server, $vital, CACHE_QUARTER_HOUR);
|
Cache::set($cachekey_server.$server, $vital, CACHE_QUARTER_HOUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($vital) AND !$vital) {
|
if (!is_null($vital) && !$vital) {
|
||||||
logger('queue: skipping dead server: '.$server);
|
logger('queue: skipping dead server: '.$server);
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -10,7 +10,7 @@ function convertquote($body, $reply)
|
||||||
$quoteline = $arrbody[$i];
|
$quoteline = $arrbody[$i];
|
||||||
|
|
||||||
while ((strlen($quoteline)>0) and ((substr($quoteline, 0, 1) == '>')
|
while ((strlen($quoteline)>0) and ((substr($quoteline, 0, 1) == '>')
|
||||||
or (substr($quoteline, 0, 1) == ' '))) {
|
|| (substr($quoteline, 0, 1) == ' '))) {
|
||||||
if (substr($quoteline, 0, 1) == '>')
|
if (substr($quoteline, 0, 1) == '>')
|
||||||
$quotelevel++;
|
$quotelevel++;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ function ref_session_write($id, $data) {
|
||||||
|
|
||||||
$memcache = cache::memcache();
|
$memcache = cache::memcache();
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
if (is_object($memcache) AND is_object($a)) {
|
if (is_object($memcache) && is_object($a)) {
|
||||||
$memcache->set($a->get_hostname().":session:".$id, $data, MEMCACHE_COMPRESSED, $expire);
|
$memcache->set($a->get_hostname().":session:".$id, $data, MEMCACHE_COMPRESSED, $expire);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ function poco_load_worker($cid, $uid, $zcid, $url) {
|
||||||
$gender = $entry->gender;
|
$gender = $entry->gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($entry->generation) AND ($entry->generation > 0)) {
|
if (isset($entry->generation) && ($entry->generation > 0)) {
|
||||||
$generation = ++$entry->generation;
|
$generation = ++$entry->generation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ function poco_load_worker($cid, $uid, $zcid, $url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($entry->contactType) AND ($entry->contactType >= 0))
|
if (isset($entry->contactType) && ($entry->contactType >= 0))
|
||||||
$contact_type = $entry->contactType;
|
$contact_type = $entry->contactType;
|
||||||
|
|
||||||
$gcontact = array("url" => $profile_url,
|
$gcontact = array("url" => $profile_url,
|
||||||
|
@ -238,7 +238,7 @@ function sanitize_gcontact($gcontact) {
|
||||||
$alternate = poco_alternate_ostatus_url($gcontact['url']);
|
$alternate = poco_alternate_ostatus_url($gcontact['url']);
|
||||||
|
|
||||||
// The global contacts should contain the original picture, not the cached one
|
// The global contacts should contain the original picture, not the cached one
|
||||||
if (($gcontact['generation'] != 1) AND stristr(normalise_link($gcontact['photo']), normalise_link(App::get_baseurl()."/photo/"))) {
|
if (($gcontact['generation'] != 1) && stristr(normalise_link($gcontact['photo']), normalise_link(App::get_baseurl()."/photo/"))) {
|
||||||
$gcontact['photo'] = "";
|
$gcontact['photo'] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ function sanitize_gcontact($gcontact) {
|
||||||
$gcontact['network'] = $r[0]["network"];
|
$gcontact['network'] = $r[0]["network"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($gcontact['network'] == "") OR ($gcontact['network'] == NETWORK_OSTATUS)) {
|
if (($gcontact['network'] == "") || ($gcontact['network'] == NETWORK_OSTATUS)) {
|
||||||
$r = q("SELECT `network`, `url` FROM `contact` WHERE `uid` = 0 AND `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
|
$r = q("SELECT `network`, `url` FROM `contact` WHERE `uid` = 0 AND `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
|
||||||
dbesc($gcontact['url']), dbesc(normalise_link($gcontact['url'])), dbesc(NETWORK_STATUSNET)
|
dbesc($gcontact['url']), dbesc(normalise_link($gcontact['url'])), dbesc(NETWORK_STATUSNET)
|
||||||
);
|
);
|
||||||
|
@ -268,13 +268,13 @@ function sanitize_gcontact($gcontact) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($x)) {
|
if (count($x)) {
|
||||||
if (!isset($gcontact['network']) AND ($x[0]["network"] != NETWORK_STATUSNET)) {
|
if (!isset($gcontact['network']) && ($x[0]["network"] != NETWORK_STATUSNET)) {
|
||||||
$gcontact['network'] = $x[0]["network"];
|
$gcontact['network'] = $x[0]["network"];
|
||||||
}
|
}
|
||||||
if ($gcontact['updated'] <= NULL_DATE) {
|
if ($gcontact['updated'] <= NULL_DATE) {
|
||||||
$gcontact['updated'] = $x[0]["updated"];
|
$gcontact['updated'] = $x[0]["updated"];
|
||||||
}
|
}
|
||||||
if (!isset($gcontact['server_url']) AND (normalise_link($x[0]["server_url"]) != normalise_link($x[0]["url"]))) {
|
if (!isset($gcontact['server_url']) && (normalise_link($x[0]["server_url"]) != normalise_link($x[0]["url"]))) {
|
||||||
$gcontact['server_url'] = $x[0]["server_url"];
|
$gcontact['server_url'] = $x[0]["server_url"];
|
||||||
}
|
}
|
||||||
if (!isset($gcontact['addr'])) {
|
if (!isset($gcontact['addr'])) {
|
||||||
|
@ -282,8 +282,8 @@ function sanitize_gcontact($gcontact) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!isset($gcontact['network']) OR !isset($gcontact['name']) OR !isset($gcontact['addr']) OR !isset($gcontact['photo']) OR !isset($gcontact['server_url']) OR $alternate)
|
if ((!isset($gcontact['network']) || !isset($gcontact['name']) || !isset($gcontact['addr']) || !isset($gcontact['photo']) || !isset($gcontact['server_url']) || $alternate)
|
||||||
AND poco_reachable($gcontact['url'], $gcontact['server_url'], $gcontact['network'], false)) {
|
&& poco_reachable($gcontact['url'], $gcontact['server_url'], $gcontact['network'], false)) {
|
||||||
$data = Probe::uri($gcontact['url']);
|
$data = Probe::uri($gcontact['url']);
|
||||||
|
|
||||||
if ($data["network"] == NETWORK_PHANTOM) {
|
if ($data["network"] == NETWORK_PHANTOM) {
|
||||||
|
@ -296,7 +296,7 @@ function sanitize_gcontact($gcontact) {
|
||||||
|
|
||||||
$gcontact = array_merge($gcontact, $data);
|
$gcontact = array_merge($gcontact, $data);
|
||||||
|
|
||||||
if ($alternate AND ($gcontact['network'] == NETWORK_OSTATUS)) {
|
if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
|
||||||
// Delete the old entry - if it exists
|
// Delete the old entry - if it exists
|
||||||
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
|
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
@ -306,7 +306,7 @@ function sanitize_gcontact($gcontact) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($gcontact['name']) OR !isset($gcontact['photo'])) {
|
if (!isset($gcontact['name']) || !isset($gcontact['photo'])) {
|
||||||
throw new Exception('No name and photo for URL '.$gcontact['url']);
|
throw new Exception('No name and photo for URL '.$gcontact['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,11 +483,11 @@ function poco_last_updated($profile, $force = false) {
|
||||||
$server_url = normalise_link(poco_detect_server($profile));
|
$server_url = normalise_link(poco_detect_server($profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($server_url == '') AND ($gcontacts[0]["server_url"] != "")) {
|
if (($server_url == '') && ($gcontacts[0]["server_url"] != "")) {
|
||||||
$server_url = $gcontacts[0]["server_url"];
|
$server_url = $gcontacts[0]["server_url"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$force AND (($server_url == '') OR ($gcontacts[0]["server_url"] == $gcontacts[0]["nurl"]))) {
|
if (!$force && (($server_url == '') || ($gcontacts[0]["server_url"] == $gcontacts[0]["nurl"]))) {
|
||||||
$server_url = normalise_link(poco_detect_server($profile));
|
$server_url = normalise_link(poco_detect_server($profile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ function poco_last_updated($profile, $force = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// noscrape is really fast so we don't cache the call.
|
// noscrape is really fast so we don't cache the call.
|
||||||
if (($server_url != "") AND ($gcontacts[0]["nick"] != "")) {
|
if (($server_url != "") && ($gcontacts[0]["nick"] != "")) {
|
||||||
|
|
||||||
// Use noscrape if possible
|
// Use noscrape if possible
|
||||||
$server = q("SELECT `noscrape`, `network` FROM `gserver` WHERE `nurl` = '%s' AND `noscrape` != ''", dbesc(normalise_link($server_url)));
|
$server = q("SELECT `noscrape`, `network` FROM `gserver` WHERE `nurl` = '%s' AND `noscrape` != ''", dbesc(normalise_link($server_url)));
|
||||||
|
@ -529,7 +529,7 @@ function poco_last_updated($profile, $force = false) {
|
||||||
if ($server) {
|
if ($server) {
|
||||||
$noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
|
$noscraperet = z_fetch_url($server[0]["noscrape"]."/".$gcontacts[0]["nick"]);
|
||||||
|
|
||||||
if ($noscraperet["success"] AND ($noscraperet["body"] != "")) {
|
if ($noscraperet["success"] && ($noscraperet["body"] != "")) {
|
||||||
|
|
||||||
$noscrape = json_decode($noscraperet["body"], true);
|
$noscrape = json_decode($noscraperet["body"], true);
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ function poco_last_updated($profile, $force = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we only can poll the feed, then we only do this once a while
|
// If we only can poll the feed, then we only do this once a while
|
||||||
if (!$force AND !poco_do_update($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
|
if (!$force && !poco_do_update($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
|
||||||
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
||||||
|
|
||||||
update_gcontact($contact);
|
update_gcontact($contact);
|
||||||
|
@ -604,8 +604,8 @@ function poco_last_updated($profile, $force = false) {
|
||||||
|
|
||||||
// Is the profile link the alternate OStatus link notation? (http://domain.tld/user/4711)
|
// Is the profile link the alternate OStatus link notation? (http://domain.tld/user/4711)
|
||||||
// Then check the other link and delete this one
|
// Then check the other link and delete this one
|
||||||
if (($data["network"] == NETWORK_OSTATUS) AND poco_alternate_ostatus_url($profile) AND
|
if (($data["network"] == NETWORK_OSTATUS) && poco_alternate_ostatus_url($profile) &&
|
||||||
(normalise_link($profile) == normalise_link($data["alias"])) AND
|
(normalise_link($profile) == normalise_link($data["alias"])) &&
|
||||||
(normalise_link($profile) != normalise_link($data["url"]))) {
|
(normalise_link($profile) != normalise_link($data["url"]))) {
|
||||||
|
|
||||||
// Delete the old entry
|
// Delete the old entry
|
||||||
|
@ -629,7 +629,7 @@ function poco_last_updated($profile, $force = false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data["poll"] == "") OR (in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) {
|
if (($data["poll"] == "") || (in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) {
|
||||||
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
|
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
|
||||||
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
|
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
|
||||||
|
|
||||||
|
@ -717,24 +717,24 @@ function poco_do_update($created, $updated, $last_failure, $last_contact) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If the last contact was less than a week ago and the last failure is older than a week then don't update
|
// If the last contact was less than a week ago and the last failure is older than a week then don't update
|
||||||
//if ((($now - $contact_time) < (60 * 60 * 24 * 7)) AND ($contact_time > $failure_time))
|
//if ((($now - $contact_time) < (60 * 60 * 24 * 7)) && ($contact_time > $failure_time))
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
// If the last contact time was more than a week ago and the contact was created more than a week ago, then only try once a week
|
// If the last contact time was more than a week ago and the contact was created more than a week ago, then only try once a week
|
||||||
if ((($now - $contact_time) > (60 * 60 * 24 * 7)) AND (($now - $created_time) > (60 * 60 * 24 * 7)) AND (($now - $failure_time) < (60 * 60 * 24 * 7)))
|
if ((($now - $contact_time) > (60 * 60 * 24 * 7)) && (($now - $created_time) > (60 * 60 * 24 * 7)) && (($now - $failure_time) < (60 * 60 * 24 * 7)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If the last contact time was more than a month ago and the contact was created more than a month ago, then only try once a month
|
// If the last contact time was more than a month ago and the contact was created more than a month ago, then only try once a month
|
||||||
if ((($now - $contact_time) > (60 * 60 * 24 * 30)) AND (($now - $created_time) > (60 * 60 * 24 * 30)) AND (($now - $failure_time) < (60 * 60 * 24 * 30)))
|
if ((($now - $contact_time) > (60 * 60 * 24 * 30)) && (($now - $created_time) > (60 * 60 * 24 * 30)) && (($now - $failure_time) < (60 * 60 * 24 * 30)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function poco_to_boolean($val) {
|
function poco_to_boolean($val) {
|
||||||
if (($val == "true") OR ($val == 1))
|
if (($val == "true") || ($val == 1))
|
||||||
return(true);
|
return(true);
|
||||||
if (($val == "false") OR ($val == 0))
|
if (($val == "false") || ($val == 0))
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
return ($val);
|
return ($val);
|
||||||
|
@ -825,7 +825,7 @@ function poco_fetch_nodeinfo($server_url) {
|
||||||
|
|
||||||
$server['register_policy'] = REGISTER_CLOSED;
|
$server['register_policy'] = REGISTER_CLOSED;
|
||||||
|
|
||||||
if (is_bool($nodeinfo->openRegistrations) AND $nodeinfo->openRegistrations) {
|
if (is_bool($nodeinfo->openRegistrations) && $nodeinfo->openRegistrations) {
|
||||||
$server['register_policy'] = REGISTER_OPEN;
|
$server['register_policy'] = REGISTER_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -977,7 +977,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
$info = $servers[0]["info"];
|
$info = $servers[0]["info"];
|
||||||
$register_policy = $servers[0]["register_policy"];
|
$register_policy = $servers[0]["register_policy"];
|
||||||
|
|
||||||
if (!$force AND !poco_do_update($servers[0]["created"], "", $last_failure, $last_contact)) {
|
if (!$force && !poco_do_update($servers[0]["created"], "", $last_failure, $last_contact)) {
|
||||||
logger("Use cached data for server ".$server_url, LOGGER_DEBUG);
|
logger("Use cached data for server ".$server_url, LOGGER_DEBUG);
|
||||||
return ($last_contact >= $last_failure);
|
return ($last_contact >= $last_failure);
|
||||||
}
|
}
|
||||||
|
@ -1009,7 +1009,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
|
|
||||||
// Quit if there is a timeout.
|
// Quit if there is a timeout.
|
||||||
// But we want to make sure to only quit if we are mostly sure that this server url fits.
|
// But we want to make sure to only quit if we are mostly sure that this server url fits.
|
||||||
if (dbm::is_result($servers) AND ($orig_server_url == $server_url) AND
|
if (dbm::is_result($servers) && ($orig_server_url == $server_url) &&
|
||||||
($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||||
dba::p("UPDATE `gserver` SET `last_failure` = ? WHERE `nurl` = ?", datetime_convert(), normalise_link($server_url));
|
dba::p("UPDATE `gserver` SET `last_failure` = ? WHERE `nurl` = ?", datetime_convert(), normalise_link($server_url));
|
||||||
|
@ -1018,7 +1018,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
|
|
||||||
// Maybe the page is unencrypted only?
|
// Maybe the page is unencrypted only?
|
||||||
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
||||||
if (!$serverret["success"] OR ($serverret["body"] == "") OR (@sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
if (!$serverret["success"] || ($serverret["body"] == "") || (@sizeof($xmlobj) == 0) || !is_object($xmlobj)) {
|
||||||
$server_url = str_replace("https://", "http://", $server_url);
|
$server_url = str_replace("https://", "http://", $server_url);
|
||||||
|
|
||||||
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
|
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
|
||||||
|
@ -1034,7 +1034,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$serverret["success"] OR ($serverret["body"] == "") OR (sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
if (!$serverret["success"] || ($serverret["body"] == "") || (sizeof($xmlobj) == 0) || !is_object($xmlobj)) {
|
||||||
// Workaround for bad configured servers (known nginx problem)
|
// Workaround for bad configured servers (known nginx problem)
|
||||||
if (!in_array($serverret["debug"]["http_code"], array("403", "404"))) {
|
if (!in_array($serverret["debug"]["http_code"], array("403", "404"))) {
|
||||||
$failure = true;
|
$failure = true;
|
||||||
|
@ -1073,7 +1073,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
// Test for Diaspora, Hubzilla, Mastodon or older Friendica servers
|
// Test for Diaspora, Hubzilla, Mastodon or older Friendica servers
|
||||||
$serverret = z_fetch_url($server_url);
|
$serverret = z_fetch_url($server_url);
|
||||||
|
|
||||||
if (!$serverret["success"] OR ($serverret["body"] == "")) {
|
if (!$serverret["success"] || ($serverret["body"] == "")) {
|
||||||
$failure = true;
|
$failure = true;
|
||||||
} else {
|
} else {
|
||||||
$server = poco_detect_server_type($serverret["body"]);
|
$server = poco_detect_server_type($serverret["body"]);
|
||||||
|
@ -1106,13 +1106,13 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$failure AND ($poco == "")) {
|
if (!$failure && ($poco == "")) {
|
||||||
// Test for Statusnet
|
// Test for Statusnet
|
||||||
// Will also return data for Friendica and GNU Social - but it will be overwritten later
|
// Will also return data for Friendica and GNU Social - but it will be overwritten later
|
||||||
// The "not implemented" is a special treatment for really, really old Friendica versions
|
// The "not implemented" is a special treatment for really, really old Friendica versions
|
||||||
$serverret = z_fetch_url($server_url."/api/statusnet/version.json");
|
$serverret = z_fetch_url($server_url."/api/statusnet/version.json");
|
||||||
if ($serverret["success"] AND ($serverret["body"] != '{"error":"not implemented"}') AND
|
if ($serverret["success"] && ($serverret["body"] != '{"error":"not implemented"}') &&
|
||||||
($serverret["body"] != '') AND (strlen($serverret["body"]) < 30)) {
|
($serverret["body"] != '') && (strlen($serverret["body"]) < 30)) {
|
||||||
$platform = "StatusNet";
|
$platform = "StatusNet";
|
||||||
// Remove junk that some GNU Social servers return
|
// Remove junk that some GNU Social servers return
|
||||||
$version = str_replace(chr(239).chr(187).chr(191), "", $serverret["body"]);
|
$version = str_replace(chr(239).chr(187).chr(191), "", $serverret["body"]);
|
||||||
|
@ -1122,8 +1122,8 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
|
|
||||||
// Test for GNU Social
|
// Test for GNU Social
|
||||||
$serverret = z_fetch_url($server_url."/api/gnusocial/version.json");
|
$serverret = z_fetch_url($server_url."/api/gnusocial/version.json");
|
||||||
if ($serverret["success"] AND ($serverret["body"] != '{"error":"not implemented"}') AND
|
if ($serverret["success"] && ($serverret["body"] != '{"error":"not implemented"}') &&
|
||||||
($serverret["body"] != '') AND (strlen($serverret["body"]) < 30)) {
|
($serverret["body"] != '') && (strlen($serverret["body"]) < 30)) {
|
||||||
$platform = "GNU Social";
|
$platform = "GNU Social";
|
||||||
// Remove junk that some GNU Social servers return
|
// Remove junk that some GNU Social servers return
|
||||||
$version = str_replace(chr(239).chr(187).chr(191), "", $serverret["body"]);
|
$version = str_replace(chr(239).chr(187).chr(191), "", $serverret["body"]);
|
||||||
|
@ -1133,7 +1133,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
|
|
||||||
// Test for Mastodon
|
// Test for Mastodon
|
||||||
$serverret = z_fetch_url($server_url."/api/v1/instance");
|
$serverret = z_fetch_url($server_url."/api/v1/instance");
|
||||||
if ($serverret["success"] AND ($serverret["body"] != '')) {
|
if ($serverret["success"] && ($serverret["body"] != '')) {
|
||||||
$data = json_decode($serverret["body"]);
|
$data = json_decode($serverret["body"]);
|
||||||
if (isset($data->version)) {
|
if (isset($data->version)) {
|
||||||
$platform = "Mastodon";
|
$platform = "Mastodon";
|
||||||
|
@ -1188,9 +1188,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
$data->site->private = poco_to_boolean($data->site->private);
|
$data->site->private = poco_to_boolean($data->site->private);
|
||||||
$data->site->inviteonly = poco_to_boolean($data->site->inviteonly);
|
$data->site->inviteonly = poco_to_boolean($data->site->inviteonly);
|
||||||
|
|
||||||
if (!$data->site->closed AND !$data->site->private and $data->site->inviteonly) {
|
if (!$data->site->closed && !$data->site->private and $data->site->inviteonly) {
|
||||||
$register_policy = REGISTER_APPROVE;
|
$register_policy = REGISTER_APPROVE;
|
||||||
} elseif (!$data->site->closed AND !$data->site->private) {
|
} elseif (!$data->site->closed && !$data->site->private) {
|
||||||
$register_policy = REGISTER_OPEN;
|
$register_policy = REGISTER_OPEN;
|
||||||
} else {
|
} else {
|
||||||
$register_policy = REGISTER_CLOSED;
|
$register_policy = REGISTER_CLOSED;
|
||||||
|
@ -1255,7 +1255,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
|
|
||||||
// Check for noscrape
|
// Check for noscrape
|
||||||
// Friendica servers could be detected as OStatus servers
|
// Friendica servers could be detected as OStatus servers
|
||||||
if (!$failure AND in_array($network, array(NETWORK_DFRN, NETWORK_OSTATUS))) {
|
if (!$failure && in_array($network, array(NETWORK_DFRN, NETWORK_OSTATUS))) {
|
||||||
$serverret = z_fetch_url($server_url."/friendica/json");
|
$serverret = z_fetch_url($server_url."/friendica/json");
|
||||||
|
|
||||||
if (!$serverret["success"]) {
|
if (!$serverret["success"]) {
|
||||||
|
@ -1290,7 +1290,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($possible_failure AND !$failure) {
|
if ($possible_failure && !$failure) {
|
||||||
$failure = true;
|
$failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,9 +1302,9 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
$last_failure = $orig_last_failure;
|
$last_failure = $orig_last_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($last_contact <= $last_failure) AND !$failure) {
|
if (($last_contact <= $last_failure) && !$failure) {
|
||||||
logger("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG);
|
logger("Server ".$server_url." seems to be alive, but last contact wasn't set - could be a bug", LOGGER_DEBUG);
|
||||||
} elseif (($last_contact >= $last_failure) AND $failure) {
|
} else if (($last_contact >= $last_failure) && $failure) {
|
||||||
logger("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG);
|
logger("Server ".$server_url." seems to be dead, but last failure wasn't set - could be a bug", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1746,7 +1746,7 @@ function poco_discover_single_server($id) {
|
||||||
$success = poco_discover_server(json_decode($retdata["body"]));
|
$success = poco_discover_server(json_decode($retdata["body"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$success AND (get_config('system','poco_discovery') > 2)) {
|
if (!$success && (get_config('system','poco_discovery') > 2)) {
|
||||||
logger("Fetch contacts from users of the server ".$server["nurl"], LOGGER_DEBUG);
|
logger("Fetch contacts from users of the server ".$server["nurl"], LOGGER_DEBUG);
|
||||||
poco_discover_server_users($data, $server);
|
poco_discover_server_users($data, $server);
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1793,7 @@ function poco_discover($complete = false) {
|
||||||
logger('Update directory from server '.$server['url'].' with ID '.$server['id'], LOGGER_DEBUG);
|
logger('Update directory from server '.$server['url'].' with ID '.$server['id'], LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server_directory", intval($server['id']));
|
proc_run(PRIORITY_LOW, "include/discover_poco.php", "update_server_directory", intval($server['id']));
|
||||||
|
|
||||||
if (!$complete AND (--$no_of_queries == 0)) {
|
if (!$complete && (--$no_of_queries == 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1833,7 +1833,7 @@ function poco_discover_server_users($data, $server) {
|
||||||
|
|
||||||
function poco_discover_server($data, $default_generation = 0) {
|
function poco_discover_server($data, $default_generation = 0) {
|
||||||
|
|
||||||
if (!isset($data->entry) OR !count($data->entry)) {
|
if (!isset($data->entry) || !count($data->entry)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1897,11 +1897,11 @@ function poco_discover_server($data, $default_generation = 0) {
|
||||||
$gender = $entry->gender;
|
$gender = $entry->gender;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($entry->generation) AND ($entry->generation > 0)) {
|
if(isset($entry->generation) && ($entry->generation > 0)) {
|
||||||
$generation = ++$entry->generation;
|
$generation = ++$entry->generation;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($entry->contactType) AND ($entry->contactType >= 0)) {
|
if(isset($entry->contactType) && ($entry->contactType >= 0)) {
|
||||||
$contact_type = $entry->contactType;
|
$contact_type = $entry->contactType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1951,7 +1951,7 @@ function poco_discover_server($data, $default_generation = 0) {
|
||||||
function clean_contact_url($url) {
|
function clean_contact_url($url) {
|
||||||
$parts = parse_url($url);
|
$parts = parse_url($url);
|
||||||
|
|
||||||
if (!isset($parts["scheme"]) OR !isset($parts["host"])) {
|
if (!isset($parts["scheme"]) || !isset($parts["host"])) {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1978,7 +1978,7 @@ function clean_contact_url($url) {
|
||||||
* @param arr $contact contact array (called by reference)
|
* @param arr $contact contact array (called by reference)
|
||||||
*/
|
*/
|
||||||
function fix_alternate_contact_address(&$contact) {
|
function fix_alternate_contact_address(&$contact) {
|
||||||
if (($contact["network"] == NETWORK_OSTATUS) AND poco_alternate_ostatus_url($contact["url"])) {
|
if (($contact["network"] == NETWORK_OSTATUS) && poco_alternate_ostatus_url($contact["url"])) {
|
||||||
$data = probe_url($contact["url"]);
|
$data = probe_url($contact["url"]);
|
||||||
if ($contact["network"] == NETWORK_OSTATUS) {
|
if ($contact["network"] == NETWORK_OSTATUS) {
|
||||||
logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".App::callstack(), LOGGER_DEBUG);
|
logger("Fix primary url from ".$contact["url"]." to ".$data["url"]." - Called by: ".App::callstack(), LOGGER_DEBUG);
|
||||||
|
@ -2023,7 +2023,8 @@ function get_gcontact_id($contact) {
|
||||||
$contact["url"] = clean_contact_url($contact["url"]);
|
$contact["url"] = clean_contact_url($contact["url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 2",
|
dba::lock('gcontact');
|
||||||
|
$r = q("SELECT `id`, `last_contact`, `last_failure`, `network` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||||
dbesc(normalise_link($contact["url"])));
|
dbesc(normalise_link($contact["url"])));
|
||||||
|
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
|
@ -2035,7 +2036,7 @@ function get_gcontact_id($contact) {
|
||||||
$last_failure = strtotime($r[0]["last_failure"]);
|
$last_failure = strtotime($r[0]["last_failure"]);
|
||||||
$last_contact_str = $r[0]["last_contact"];
|
$last_contact_str = $r[0]["last_contact"];
|
||||||
$last_contact = strtotime($r[0]["last_contact"]);
|
$last_contact = strtotime($r[0]["last_contact"]);
|
||||||
$doprobing = (((time() - $last_contact) > (90 * 86400)) AND ((time() - $last_failure) > (90 * 86400)));
|
$doprobing = (((time() - $last_contact) > (90 * 86400)) && ((time() - $last_failure) > (90 * 86400)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `hide`, `generation`)
|
q("INSERT INTO `gcontact` (`name`, `nick`, `addr` , `network`, `url`, `nurl`, `photo`, `created`, `updated`, `location`, `about`, `hide`, `generation`)
|
||||||
|
@ -2064,18 +2065,13 @@ function get_gcontact_id($contact) {
|
||||||
$doprobing = in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""));
|
$doprobing = in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dba::unlock();
|
||||||
|
|
||||||
if ($doprobing) {
|
if ($doprobing) {
|
||||||
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
logger("Last Contact: ". $last_contact_str." - Last Failure: ".$last_failure_str." - Checking: ".$contact["url"], LOGGER_DEBUG);
|
||||||
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
|
proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != "")) {
|
|
||||||
q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
|
|
||||||
dbesc(normalise_link($contact["url"])),
|
|
||||||
intval($gcontact_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $gcontact_id;
|
return $gcontact_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2088,7 +2084,7 @@ function get_gcontact_id($contact) {
|
||||||
function update_gcontact($contact) {
|
function update_gcontact($contact) {
|
||||||
|
|
||||||
// Check for invalid "contact-type" value
|
// Check for invalid "contact-type" value
|
||||||
if (isset($contact['contact-type']) AND (intval($contact['contact-type']) < 0)) {
|
if (isset($contact['contact-type']) && (intval($contact['contact-type']) < 0)) {
|
||||||
$contact['contact-type'] = 0;
|
$contact['contact-type'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2126,8 +2122,8 @@ function update_gcontact($contact) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign all unassigned fields from the database entry
|
// assign all unassigned fields from the database entry
|
||||||
foreach ($fields AS $field => $data) {
|
foreach ($fields as $field => $data)
|
||||||
if (!isset($contact[$field]) OR ($contact[$field] == "")) {
|
if (!isset($contact[$field]) || ($contact[$field] == "")) {
|
||||||
$contact[$field] = $r[0][$field];
|
$contact[$field] = $r[0][$field];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2170,7 +2166,7 @@ function update_gcontact($contact) {
|
||||||
$contact["server_url"] = normalise_link($contact["server_url"]);
|
$contact["server_url"] = normalise_link($contact["server_url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($contact["addr"] == "") AND ($contact["server_url"] != "") AND ($contact["nick"] != "")) {
|
if (($contact["addr"] == "") && ($contact["server_url"] != "") && ($contact["nick"] != "")) {
|
||||||
$hostname = str_replace("http://", "", $contact["server_url"]);
|
$hostname = str_replace("http://", "", $contact["server_url"]);
|
||||||
$contact["addr"] = $contact["nick"]."@".$hostname;
|
$contact["addr"] = $contact["nick"]."@".$hostname;
|
||||||
}
|
}
|
||||||
|
@ -2179,7 +2175,7 @@ function update_gcontact($contact) {
|
||||||
$update = false;
|
$update = false;
|
||||||
unset($fields["generation"]);
|
unset($fields["generation"]);
|
||||||
|
|
||||||
if ((($contact["generation"] > 0) AND ($contact["generation"] <= $r[0]["generation"])) OR ($r[0]["generation"] == 0)) {
|
if ((($contact["generation"] > 0) && ($contact["generation"] <= $r[0]["generation"])) || ($r[0]["generation"] == 0)) {
|
||||||
foreach ($fields AS $field => $data) {
|
foreach ($fields AS $field => $data) {
|
||||||
if ($contact[$field] != $r[0][$field]) {
|
if ($contact[$field] != $r[0][$field]) {
|
||||||
logger("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$r[0][$field]."'", LOGGER_DEBUG);
|
logger("Difference for contact ".$contact["url"]." in field '".$field."'. New value: '".$contact[$field]."', old value '".$r[0][$field]."'", LOGGER_DEBUG);
|
||||||
|
@ -2286,7 +2282,7 @@ function update_gcontact_for_user($uid) {
|
||||||
"gender" => $r[0]["gender"], "keywords" => $r[0]["pub_keywords"],
|
"gender" => $r[0]["gender"], "keywords" => $r[0]["pub_keywords"],
|
||||||
"birthday" => $r[0]["dob"], "photo" => $r[0]["photo"],
|
"birthday" => $r[0]["dob"], "photo" => $r[0]["photo"],
|
||||||
"notify" => $r[0]["notify"], "url" => $r[0]["url"],
|
"notify" => $r[0]["notify"], "url" => $r[0]["url"],
|
||||||
"hide" => ($r[0]["hidewall"] OR !$r[0]["net-publish"]),
|
"hide" => ($r[0]["hidewall"] || !$r[0]["net-publish"]),
|
||||||
"nick" => $r[0]["nickname"], "addr" => $addr,
|
"nick" => $r[0]["nickname"], "addr" => $addr,
|
||||||
"connect" => $addr, "server_url" => App::get_baseurl(),
|
"connect" => $addr, "server_url" => App::get_baseurl(),
|
||||||
"generation" => 1, "network" => NETWORK_DFRN);
|
"generation" => 1, "network" => NETWORK_DFRN);
|
||||||
|
|
|
@ -13,7 +13,7 @@ function spool_post_run($argv, $argc) {
|
||||||
|
|
||||||
$path = get_spoolpath();
|
$path = get_spoolpath();
|
||||||
|
|
||||||
if (($path != '') AND is_writable($path)){
|
if (($path != '') && is_writable($path)){
|
||||||
if ($dh = opendir($path)) {
|
if ($dh = opendir($path)) {
|
||||||
while (($file = readdir($dh)) !== false) {
|
while (($file = readdir($dh)) !== false) {
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ function spool_post_run($argv, $argc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can't read or write the file? So we don't care about it.
|
// We can't read or write the file? So we don't care about it.
|
||||||
if (!is_writable($fullfile) OR !is_readable($fullfile)) {
|
if (!is_writable($fullfile) || !is_readable($fullfile)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ function spool_post_run($argv, $argc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip if it doesn't seem to be an item array
|
// Skip if it doesn't seem to be an item array
|
||||||
if (!isset($arr['uid']) AND !isset($arr['uri']) AND !isset($arr['network'])) {
|
if (!isset($arr['uid']) && !isset($arr['uri']) && !isset($arr['network'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ function create_tags_from_item($itemid) {
|
||||||
|
|
||||||
$tags = "";
|
$tags = "";
|
||||||
foreach ($taglist as $tag)
|
foreach ($taglist as $tag)
|
||||||
if ((substr(trim($tag), 0, 1) == "#") OR (substr(trim($tag), 0, 1) == "@"))
|
if ((substr(trim($tag), 0, 1) == "#") || (substr(trim($tag), 0, 1) == "@"))
|
||||||
$tags .= " ".trim($tag);
|
$tags .= " ".trim($tag);
|
||||||
else
|
else
|
||||||
$tags .= " #".trim($tag);
|
$tags .= " #".trim($tag);
|
||||||
|
@ -91,7 +91,7 @@ function create_tags_from_item($itemid) {
|
||||||
dbesc($link), dbesc($message["guid"]), dbesc($message["created"]), dbesc($message["received"]), intval($global));
|
dbesc($link), dbesc($message["guid"]), dbesc($message["created"]), dbesc($message["received"]), intval($global));
|
||||||
|
|
||||||
// Search for mentions
|
// Search for mentions
|
||||||
if ((substr($tag, 0, 1) == '@') AND (strpos($link, $profile_base_friendica) OR strpos($link, $profile_base_diaspora))) {
|
if ((substr($tag, 0, 1) == '@') && (strpos($link, $profile_base_friendica) || strpos($link, $profile_base_diaspora))) {
|
||||||
$users = q("SELECT `uid` FROM `contact` WHERE self AND (`url` = '%s' OR `nurl` = '%s')", $link, $link);
|
$users = q("SELECT `uid` FROM `contact` WHERE self AND (`url` = '%s' OR `nurl` = '%s')", $link, $link);
|
||||||
foreach ($users AS $user) {
|
foreach ($users AS $user) {
|
||||||
if ($user["uid"] == $message["uid"]) {
|
if ($user["uid"] == $message["uid"]) {
|
||||||
|
|
|
@ -293,7 +293,7 @@ function paginate_data(App $a, $count = null) {
|
||||||
$stripped = trim($stripped, '/');
|
$stripped = trim($stripped, '/');
|
||||||
$pagenum = $a->pager['page'];
|
$pagenum = $a->pager['page'];
|
||||||
|
|
||||||
if (($a->page_offset != '') AND !preg_match('/[?&].offset=/', $stripped)) {
|
if (($a->page_offset != '') && !preg_match('/[?&].offset=/', $stripped)) {
|
||||||
$stripped .= '&offset=' . urlencode($a->page_offset);
|
$stripped .= '&offset=' . urlencode($a->page_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1276,8 +1276,8 @@ function redir_private_images($a, &$item)
|
||||||
|
|
||||||
function put_item_in_cache(&$item, $update = false) {
|
function put_item_in_cache(&$item, $update = false) {
|
||||||
|
|
||||||
if (($item["rendered-hash"] != hash("md5", $item["body"])) OR ($item["rendered-hash"] == "") OR
|
if (($item["rendered-hash"] != hash("md5", $item["body"])) || ($item["rendered-hash"] == "") ||
|
||||||
($item["rendered-html"] == "") OR get_config("system", "ignore_cache")) {
|
($item["rendered-html"] == "") || get_config("system", "ignore_cache")) {
|
||||||
|
|
||||||
// The function "redir_private_images" changes the body.
|
// The function "redir_private_images" changes the body.
|
||||||
// I'm not sure if we should store it permanently, so we save the old value.
|
// I'm not sure if we should store it permanently, so we save the old value.
|
||||||
|
@ -1290,7 +1290,7 @@ function put_item_in_cache(&$item, $update = false) {
|
||||||
$item["rendered-hash"] = hash("md5", $item["body"]);
|
$item["rendered-hash"] = hash("md5", $item["body"]);
|
||||||
$item["body"] = $body;
|
$item["body"] = $body;
|
||||||
|
|
||||||
if ($update AND ($item["id"] != 0)) {
|
if ($update && ($item["id"] != 0)) {
|
||||||
q("UPDATE `item` SET `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d",
|
q("UPDATE `item` SET `rendered-html` = '%s', `rendered-hash` = '%s' WHERE `id` = %d",
|
||||||
dbesc($item["rendered-html"]), dbesc($item["rendered-hash"]), intval($item["id"]));
|
dbesc($item["rendered-html"]), dbesc($item["rendered-hash"]), intval($item["id"]));
|
||||||
}
|
}
|
||||||
|
@ -1352,7 +1352,7 @@ function prepare_body(&$item, $attach = false, $preview = false) {
|
||||||
$update = (!local_user() and !remote_user() and ($item["uid"] == 0));
|
$update = (!local_user() and !remote_user() and ($item["uid"] == 0));
|
||||||
|
|
||||||
// Or update it if the current viewer is the intented viewer
|
// Or update it if the current viewer is the intented viewer
|
||||||
if (($item["uid"] == local_user()) AND ($item["uid"] != 0)) {
|
if (($item["uid"] == local_user()) && ($item["uid"] != 0)) {
|
||||||
$update = true;
|
$update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,12 @@ function add_shadow_thread($itemid) {
|
||||||
$item = $items[0];
|
$item = $items[0];
|
||||||
|
|
||||||
// is it already a copy?
|
// is it already a copy?
|
||||||
if (($itemid == 0) OR ($item['uid'] == 0)) {
|
if (($itemid == 0) || ($item['uid'] == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it a visible public post?
|
// Is it a visible public post?
|
||||||
if (!$item["visible"] OR $item["deleted"] OR $item["moderated"] OR $item["private"]) {
|
if (!$item["visible"] || $item["deleted"] || $item["moderated"] || $item["private"]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ function add_shadow_thread($itemid) {
|
||||||
|
|
||||||
$item = q("SELECT * FROM `item` WHERE `id` = %d", intval($itemid));
|
$item = q("SELECT * FROM `item` WHERE `id` = %d", intval($itemid));
|
||||||
|
|
||||||
if (count($item) AND ($item[0]["allow_cid"] == '') AND ($item[0]["allow_gid"] == '') AND
|
if (count($item) && ($item[0]["allow_cid"] == '') && ($item[0]["allow_gid"] == '') &&
|
||||||
($item[0]["deny_cid"] == '') AND ($item[0]["deny_gid"] == '')) {
|
($item[0]["deny_cid"] == '') && ($item[0]["deny_gid"] == '')) {
|
||||||
|
|
||||||
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1",
|
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = 0 LIMIT 1",
|
||||||
dbesc($item['uri']));
|
dbesc($item['uri']));
|
||||||
|
|
|
@ -40,16 +40,16 @@ function update_gcontact_run(&$argv, &$argc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($data["name"] == "") AND ($r[0]['name'] != ""))
|
if (($data["name"] == "") && ($r[0]['name'] != ""))
|
||||||
$data["name"] = $r[0]['name'];
|
$data["name"] = $r[0]['name'];
|
||||||
|
|
||||||
if (($data["nick"] == "") AND ($r[0]['nick'] != ""))
|
if (($data["nick"] == "") && ($r[0]['nick'] != ""))
|
||||||
$data["nick"] = $r[0]['nick'];
|
$data["nick"] = $r[0]['nick'];
|
||||||
|
|
||||||
if (($data["addr"] == "") AND ($r[0]['addr'] != ""))
|
if (($data["addr"] == "") && ($r[0]['addr'] != ""))
|
||||||
$data["addr"] = $r[0]['addr'];
|
$data["addr"] = $r[0]['addr'];
|
||||||
|
|
||||||
if (($data["photo"] == "") AND ($r[0]['photo'] != ""))
|
if (($data["photo"] == "") && ($r[0]['photo'] != ""))
|
||||||
$data["photo"] = $r[0]['photo'];
|
$data["photo"] = $r[0]['photo'];
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ class xml {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($array as $key => $value) {
|
foreach($array as $key => $value) {
|
||||||
if (!isset($element) AND isset($xml)) {
|
if (!isset($element) && isset($xml)) {
|
||||||
$element = $xml;
|
$element = $xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class xml {
|
||||||
}
|
}
|
||||||
|
|
||||||
$element_parts = explode(":", $key);
|
$element_parts = explode(":", $key);
|
||||||
if ((count($element_parts) > 1) AND isset($namespaces[$element_parts[0]])) {
|
if ((count($element_parts) > 1) && isset($namespaces[$element_parts[0]])) {
|
||||||
$namespace = $namespaces[$element_parts[0]];
|
$namespace = $namespaces[$element_parts[0]];
|
||||||
} elseif (isset($namespaces[""])) {
|
} elseif (isset($namespaces[""])) {
|
||||||
$namespace = $namespaces[""];
|
$namespace = $namespaces[""];
|
||||||
|
@ -76,18 +76,18 @@ class xml {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove undefined namespaces from the key
|
// Remove undefined namespaces from the key
|
||||||
if ((count($element_parts) > 1) AND is_null($namespace)) {
|
if ((count($element_parts) > 1) && is_null($namespace)) {
|
||||||
$key = $element_parts[1];
|
$key = $element_parts[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($key, 0, 11) == "@attributes") {
|
if (substr($key, 0, 11) == "@attributes") {
|
||||||
if (!isset($element) OR !is_array($value)) {
|
if (!isset($element) || !is_array($value)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($value as $attr_key => $attr_value) {
|
foreach ($value as $attr_key => $attr_value) {
|
||||||
$element_parts = explode(":", $attr_key);
|
$element_parts = explode(":", $attr_key);
|
||||||
if ((count($element_parts) > 1) AND isset($namespaces[$element_parts[0]])) {
|
if ((count($element_parts) > 1) && isset($namespaces[$element_parts[0]])) {
|
||||||
$namespace = $namespaces[$element_parts[0]];
|
$namespace = $namespaces[$element_parts[0]];
|
||||||
} else {
|
} else {
|
||||||
$namespace = NULL;
|
$namespace = NULL;
|
||||||
|
@ -323,7 +323,7 @@ class xml {
|
||||||
|
|
||||||
if ($type == "open") { // The starting of the tag '<tag>'
|
if ($type == "open") { // The starting of the tag '<tag>'
|
||||||
$parent[$level-1] = &$current;
|
$parent[$level-1] = &$current;
|
||||||
if (!is_array($current) or (!in_array($tag, array_keys($current)))) { // Insert New tag
|
if (!is_array($current) || (!in_array($tag, array_keys($current)))) { // Insert New tag
|
||||||
$current[$tag] = $result;
|
$current[$tag] = $result;
|
||||||
if ($attributes_data) {
|
if ($attributes_data) {
|
||||||
$current[$tag. '_attr'] = $attributes_data;
|
$current[$tag. '_attr'] = $attributes_data;
|
||||||
|
@ -399,7 +399,7 @@ class xml {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete a node in a XML object
|
* @brief Delete a node in a XML object
|
||||||
*
|
*
|
||||||
* @param object $doc XML document
|
* @param object $doc XML document
|
||||||
* @param string $node Node name
|
* @param string $node Node name
|
||||||
*/
|
*/
|
||||||
|
|
14
index.php
14
index.php
|
@ -59,15 +59,15 @@ if (!$install) {
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
if ($a->max_processes_reached() OR $a->maxload_reached()) {
|
if ($a->max_processes_reached() || $a->maxload_reached()) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable');
|
header($_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable');
|
||||||
header('Retry-After: 120');
|
header('Retry-After: 120');
|
||||||
header('Refresh: 120; url=' . App::get_baseurl() . "/" . $a->query_string);
|
header('Refresh: 120; url=' . App::get_baseurl() . "/" . $a->query_string);
|
||||||
die("System is currently unavailable. Please try again later");
|
die("System is currently unavailable. Please try again later");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_config('system', 'force_ssl') AND ($a->get_scheme() == "http") AND
|
if (get_config('system', 'force_ssl') && ($a->get_scheme() == "http") &&
|
||||||
(intval(get_config('system', 'ssl_policy')) == SSL_POLICY_FULL) AND
|
(intval(get_config('system', 'ssl_policy')) == SSL_POLICY_FULL) &&
|
||||||
(substr(App::get_baseurl(), 0, 8) == "https://")) {
|
(substr(App::get_baseurl(), 0, 8) == "https://")) {
|
||||||
header("HTTP/1.1 302 Moved Temporarily");
|
header("HTTP/1.1 302 Moved Temporarily");
|
||||||
header("Location: " . App::get_baseurl() . "/" . $a->query_string);
|
header("Location: " . App::get_baseurl() . "/" . $a->query_string);
|
||||||
|
@ -128,7 +128,7 @@ if ((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
|
||||||
if ((x($_GET,'zrl')) && (!$install && !$maintenance)) {
|
if ((x($_GET,'zrl')) && (!$install && !$maintenance)) {
|
||||||
// Only continue when the given profile link seems valid
|
// Only continue when the given profile link seems valid
|
||||||
// Valid profile links contain a path with "/profile/" and no query parameters
|
// Valid profile links contain a path with "/profile/" and no query parameters
|
||||||
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") AND
|
if ((parse_url($_GET['zrl'], PHP_URL_QUERY) == "") &&
|
||||||
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
|
strstr(parse_url($_GET['zrl'], PHP_URL_PATH), "/profile/")) {
|
||||||
$_SESSION['my_url'] = $_GET['zrl'];
|
$_SESSION['my_url'] = $_GET['zrl'];
|
||||||
$a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
|
$a->query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string);
|
||||||
|
@ -245,7 +245,7 @@ if (strlen($a->module)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compatibility with the Firefox App
|
// Compatibility with the Firefox App
|
||||||
if (($a->module == "users") AND ($a->cmd == "users/sign_in")) {
|
if (($a->module == "users") && ($a->cmd == "users/sign_in")) {
|
||||||
$a->module = "login";
|
$a->module = "login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +450,7 @@ if (!$a->theme['stylesheet']) {
|
||||||
$a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
|
$a->page['htmlhead'] = str_replace('{{$stylesheet}}',$stylesheet,$a->page['htmlhead']);
|
||||||
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
|
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
|
||||||
|
|
||||||
if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "minimal"))) {
|
if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
|
|
||||||
$target = new DOMDocument();
|
$target = new DOMDocument();
|
||||||
|
@ -473,7 +473,7 @@ if (isset($_GET["mode"]) AND (($_GET["mode"] == "raw") OR ($_GET["mode"] == "min
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["mode"]) AND ($_GET["mode"] == "raw")) {
|
if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) {
|
||||||
|
|
||||||
header("Content-type: text/html; charset=utf-8");
|
header("Content-type: text/html; charset=utf-8");
|
||||||
|
|
||||||
|
|
|
@ -545,11 +545,16 @@ function admin_page_summary(App $a) {
|
||||||
$showwarning = true;
|
$showwarning = true;
|
||||||
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
$warningtext[] = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the command <tt>php include/dbstructure.php toinnodb</tt> of your Friendica installation for an automatic conversion.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
|
||||||
}
|
}
|
||||||
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
|
|
||||||
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
|
if (Config::get('system', 'dbupdate', DB_UPDATE_NOT_CHECKED) == DB_UPDATE_NOT_CHECKED) {
|
||||||
!(strpos($db->server_info(), 'MariaDB') !== false)) {
|
require_once("include/dbstructure.php");
|
||||||
$warningtext[] = t('You are using a MySQL version which does not support all features that Friendica uses. You should consider switching to MariaDB.');
|
update_structure(false, true);
|
||||||
}
|
}
|
||||||
|
if (Config::get('system', 'dbupdate') == DB_UPDATE_FAILED) {
|
||||||
|
$showwarning = true;
|
||||||
|
$warningtext[] = t('The database update failed. Please run "php include/dbstructure.php update" from the command line and have a look at the errors that might appear.');
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
|
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
|
||||||
$accounts = array(
|
$accounts = array(
|
||||||
array(t('Normal Account'), 0),
|
array(t('Normal Account'), 0),
|
||||||
|
@ -765,7 +770,7 @@ function admin_page_site_post(App $a) {
|
||||||
$worker_frontend = ((x($_POST,'worker_frontend')) ? True : False);
|
$worker_frontend = ((x($_POST,'worker_frontend')) ? True : False);
|
||||||
|
|
||||||
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
// Has the directory url changed? If yes, then resubmit the existing profiles there
|
||||||
if ($global_directory != Config::get('system', 'directory') AND ($global_directory != '')) {
|
if ($global_directory != Config::get('system', 'directory') && ($global_directory != '')) {
|
||||||
Config::set('system', 'directory', $global_directory);
|
Config::set('system', 'directory', $global_directory);
|
||||||
proc_run(PRIORITY_LOW, 'include/directory.php');
|
proc_run(PRIORITY_LOW, 'include/directory.php');
|
||||||
}
|
}
|
||||||
|
@ -931,7 +936,7 @@ function admin_page_site(App $a) {
|
||||||
/* Installed langs */
|
/* Installed langs */
|
||||||
$lang_choices = get_available_languages();
|
$lang_choices = get_available_languages();
|
||||||
|
|
||||||
if (strlen(get_config('system','directory_submit_url')) AND
|
if (strlen(get_config('system','directory_submit_url')) &&
|
||||||
!strlen(get_config('system','directory'))) {
|
!strlen(get_config('system','directory'))) {
|
||||||
set_config('system','directory', dirname(get_config('system','directory_submit_url')));
|
set_config('system','directory', dirname(get_config('system','directory_submit_url')));
|
||||||
del_config('system','directory_submit_url');
|
del_config('system','directory_submit_url');
|
||||||
|
@ -953,7 +958,7 @@ function admin_page_site(App $a) {
|
||||||
$f = basename($file);
|
$f = basename($file);
|
||||||
|
|
||||||
// Only show allowed themes here
|
// Only show allowed themes here
|
||||||
if (($allowed_theme_list != '') AND !strstr($allowed_theme_list, $f)) {
|
if (($allowed_theme_list != '') && !strstr($allowed_theme_list, $f)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1178,7 +1183,7 @@ function admin_page_dbsync(App $a) {
|
||||||
goaway('admin/dbsync');
|
goaway('admin/dbsync');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($a->argc > 2) AND (intval($a->argv[2]) OR ($a->argv[2] === 'check'))) {
|
if (($a->argc > 2) && (intval($a->argv[2]) || ($a->argv[2] === 'check'))) {
|
||||||
require_once("include/dbstructure.php");
|
require_once("include/dbstructure.php");
|
||||||
$retval = update_structure(false, true);
|
$retval = update_structure(false, true);
|
||||||
if (!$retval) {
|
if (!$retval) {
|
||||||
|
@ -1658,7 +1663,7 @@ function admin_page_plugins(App $a) {
|
||||||
$show_plugin = true;
|
$show_plugin = true;
|
||||||
|
|
||||||
// If the addon is unsupported, then only show it, when it is enabled
|
// If the addon is unsupported, then only show it, when it is enabled
|
||||||
if ((strtolower($info["status"]) == "unsupported") AND !in_array($id, $a->plugins)) {
|
if ((strtolower($info["status"]) == "unsupported") && !in_array($id, $a->plugins)) {
|
||||||
$show_plugin = false;
|
$show_plugin = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1796,7 +1801,7 @@ function admin_page_themes(App $a) {
|
||||||
$is_supported = 1-(intval(file_exists($file.'/unsupported')));
|
$is_supported = 1-(intval(file_exists($file.'/unsupported')));
|
||||||
$is_allowed = intval(in_array($f,$allowed_themes));
|
$is_allowed = intval(in_array($f,$allowed_themes));
|
||||||
|
|
||||||
if ($is_allowed OR $is_supported OR get_config("system", "show_unsupported_themes")) {
|
if ($is_allowed || $is_supported || get_config("system", "show_unsupported_themes")) {
|
||||||
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
|
$themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,14 +68,14 @@ function community_content(App $a, $update = 0) {
|
||||||
}
|
}
|
||||||
$previousauthor = $item["author-link"];
|
$previousauthor = $item["author-link"];
|
||||||
|
|
||||||
if (($numposts < $maxpostperauthor) AND (sizeof($s) < $a->pager['itemspage'])) {
|
if (($numposts < $maxpostperauthor) && (sizeof($s) < $a->pager['itemspage'])) {
|
||||||
$s[] = $item;
|
$s[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((sizeof($s) < $a->pager['itemspage'])) {
|
if ((sizeof($s) < $a->pager['itemspage'])) {
|
||||||
$r = community_getitems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage']);
|
$r = community_getitems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage']);
|
||||||
}
|
}
|
||||||
} while ((sizeof($s) < $a->pager['itemspage']) AND (++$count < 50) AND (sizeof($r) > 0));
|
} while ((sizeof($s) < $a->pager['itemspage']) && (++$count < 50) && (sizeof($r) > 0));
|
||||||
} else {
|
} else {
|
||||||
$s = $r;
|
$s = $r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ function contacts_init(App $a) {
|
||||||
|
|
||||||
$contact_id = 0;
|
$contact_id = 0;
|
||||||
|
|
||||||
if((($a->argc == 2) && intval($a->argv[1])) OR (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
|
if((($a->argc == 2) && intval($a->argv[1])) || (($a->argc == 3) && intval($a->argv[1]) && ($a->argv[2] == "posts"))) {
|
||||||
$contact_id = intval($a->argv[1]);
|
$contact_id = intval($a->argv[1]);
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d and `id` = %d LIMIT 1",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
@ -42,7 +42,7 @@ function contacts_init(App $a) {
|
||||||
if ($contact_id) {
|
if ($contact_id) {
|
||||||
$a->data['contact'] = $r[0];
|
$a->data['contact'] = $r[0];
|
||||||
|
|
||||||
if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) {
|
if (($a->data['contact']['network'] != "") && ($a->data['contact']['network'] != NETWORK_DFRN)) {
|
||||||
$networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
|
$networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
|
||||||
} else {
|
} else {
|
||||||
$networkname = '';
|
$networkname = '';
|
||||||
|
@ -266,7 +266,7 @@ function _contact_update_profile($contact_id) {
|
||||||
$data = Probe::uri($r[0]["url"], "", 0, false);
|
$data = Probe::uri($r[0]["url"], "", 0, false);
|
||||||
|
|
||||||
// "Feed" or "Unknown" is mostly a sign of communication problems
|
// "Feed" or "Unknown" is mostly a sign of communication problems
|
||||||
if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) AND ($data["network"] != $r[0]["network"]))
|
if ((in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) && ($data["network"] != $r[0]["network"]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm",
|
$updatefields = array("name", "nick", "url", "addr", "batch", "notify", "poll", "request", "confirm",
|
||||||
|
@ -281,14 +281,14 @@ function _contact_update_profile($contact_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($updatefields AS $field)
|
foreach($updatefields AS $field)
|
||||||
if (isset($data[$field]) AND ($data[$field] != ""))
|
if (isset($data[$field]) && ($data[$field] != ""))
|
||||||
$update[$field] = $data[$field];
|
$update[$field] = $data[$field];
|
||||||
|
|
||||||
$update["nurl"] = normalise_link($data["url"]);
|
$update["nurl"] = normalise_link($data["url"]);
|
||||||
|
|
||||||
$query = "";
|
$query = "";
|
||||||
|
|
||||||
if (isset($data["priority"]) AND ($data["priority"] != 0))
|
if (isset($data["priority"]) && ($data["priority"] != 0))
|
||||||
$query = "`priority` = ".intval($data["priority"]);
|
$query = "`priority` = ".intval($data["priority"]);
|
||||||
|
|
||||||
foreach($update AS $key => $value) {
|
foreach($update AS $key => $value) {
|
||||||
|
@ -307,7 +307,7 @@ function _contact_update_profile($contact_id) {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Update the entry in the contact table
|
// Update the entry in the contact table
|
||||||
update_contact_avatar($data['photo'], local_user(), $contact_id);
|
update_contact_avatar($data['photo'], local_user(), $contact_id, true);
|
||||||
|
|
||||||
// Update the entry in the gcontact table
|
// Update the entry in the gcontact table
|
||||||
update_gcontact_from_probe($data["url"]);
|
update_gcontact_from_probe($data["url"]);
|
||||||
|
@ -573,7 +573,7 @@ function contacts_content(App $a) {
|
||||||
if ($contact['network'] == NETWORK_DFRN)
|
if ($contact['network'] == NETWORK_DFRN)
|
||||||
$profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
|
$profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
|
||||||
|
|
||||||
if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND
|
if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) &&
|
||||||
($contact['rel'] == CONTACT_IS_FOLLOWER))
|
($contact['rel'] == CONTACT_IS_FOLLOWER))
|
||||||
$follow = App::get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
|
$follow = App::get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
|
||||||
|
|
||||||
|
|
|
@ -626,7 +626,7 @@ function dfrn_request_post(App $a) {
|
||||||
);
|
);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
// END $network === NETWORK_DFRN
|
// END $network === NETWORK_DFRN
|
||||||
} elseif (($network != NETWORK_PHANTOM) AND ($url != "")) {
|
} elseif (($network != NETWORK_PHANTOM) && ($url != "")) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
@ -693,7 +693,7 @@ function dfrn_request_content(App $a) {
|
||||||
$confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : "");
|
$confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : "");
|
||||||
|
|
||||||
// Checking fastlane for validity
|
// Checking fastlane for validity
|
||||||
if (x($_SESSION, "fastlane") AND (normalise_link($_SESSION["fastlane"]) == normalise_link($dfrn_url))) {
|
if (x($_SESSION, "fastlane") && (normalise_link($_SESSION["fastlane"]) == normalise_link($dfrn_url))) {
|
||||||
$_POST["dfrn_url"] = $dfrn_url;
|
$_POST["dfrn_url"] = $dfrn_url;
|
||||||
$_POST["confirm_key"] = $confirm_key;
|
$_POST["confirm_key"] = $confirm_key;
|
||||||
$_POST["localconfirm"] = 1;
|
$_POST["localconfirm"] = 1;
|
||||||
|
@ -813,9 +813,9 @@ function dfrn_request_content(App $a) {
|
||||||
|
|
||||||
// At first look if an address was provided
|
// At first look if an address was provided
|
||||||
// Otherwise take the local address
|
// Otherwise take the local address
|
||||||
if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
|
if (x($_GET,'addr') && ($_GET['addr'] != "")) {
|
||||||
$myaddr = hex2bin($_GET['addr']);
|
$myaddr = hex2bin($_GET['addr']);
|
||||||
} elseif (x($_GET,'address') AND ($_GET['address'] != "")) {
|
} elseif (x($_GET,'address') && ($_GET['address'] != "")) {
|
||||||
$myaddr = $_GET['address'];
|
$myaddr = $_GET['address'];
|
||||||
} elseif (local_user()) {
|
} elseif (local_user()) {
|
||||||
if (strlen($a->path)) {
|
if (strlen($a->path)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
if (strpos($search,'@') === 0) {
|
if (strpos($search,'@') === 0) {
|
||||||
$search = substr($search,1);
|
$search = substr($search,1);
|
||||||
$header = sprintf( t('People Search - %s'), $search);
|
$header = sprintf( t('People Search - %s'), $search);
|
||||||
if ((valid_email($search) AND validate_email($search)) OR
|
if ((valid_email($search) && validate_email($search)) ||
|
||||||
(substr(normalise_link($search), 0, 7) == "http://")) {
|
(substr(normalise_link($search), 0, 7) == "http://")) {
|
||||||
$user_data = probe_url($search);
|
$user_data = probe_url($search);
|
||||||
$discover_user = (in_array($user_data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)));
|
$discover_user = (in_array($user_data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)));
|
||||||
|
@ -75,7 +75,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
$j->results[] = $objresult;
|
$j->results[] = $objresult;
|
||||||
|
|
||||||
// Add the contact to the global contacts if it isn't already in our system
|
// Add the contact to the global contacts if it isn't already in our system
|
||||||
if (($contact["cid"] == 0) AND ($contact["zid"] == 0) AND ($contact["gid"] == 0)) {
|
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
||||||
update_gcontact($user_data);
|
update_gcontact($user_data);
|
||||||
}
|
}
|
||||||
} elseif ($local) {
|
} elseif ($local) {
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
|
||||||
|
require_once('include/dfrn.php');
|
||||||
|
|
||||||
function display_init(App $a) {
|
function display_init(App $a) {
|
||||||
|
|
||||||
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
|
||||||
|
@ -11,6 +13,16 @@ function display_init(App $a) {
|
||||||
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
$nick = (($a->argc > 1) ? $a->argv[1] : '');
|
||||||
$profiledata = array();
|
$profiledata = array();
|
||||||
|
|
||||||
|
if ($a->argc == 3) {
|
||||||
|
if (substr($a->argv[2], -5) == '.atom') {
|
||||||
|
$item_id = substr($a->argv[2], 0, -5);
|
||||||
|
$xml = dfrn::itemFeed($item_id);
|
||||||
|
header("Content-type: application/atom+xml");
|
||||||
|
echo $xml;
|
||||||
|
http_status_exit(($xml) ? 200 : 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If there is only one parameter, then check if this parameter could be a guid
|
// If there is only one parameter, then check if this parameter could be a guid
|
||||||
if ($a->argc == 2) {
|
if ($a->argc == 2) {
|
||||||
$nick = "";
|
$nick = "";
|
||||||
|
@ -59,7 +71,7 @@ function display_init(App $a) {
|
||||||
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
|
||||||
AND `id` = %d", $r[0]["parent"]);
|
AND `id` = %d", $r[0]["parent"]);
|
||||||
}
|
}
|
||||||
if (($itemuid != local_user()) AND local_user()) {
|
if (($itemuid != local_user()) && local_user()) {
|
||||||
// Do we know this contact but we haven't got this item?
|
// Do we know this contact but we haven't got this item?
|
||||||
// Copy the wohle thread to our local storage so that we can interact.
|
// Copy the wohle thread to our local storage so that we can interact.
|
||||||
// We really should change this need for the future since it scales very bad.
|
// We really should change this need for the future since it scales very bad.
|
||||||
|
@ -129,11 +141,11 @@ function display_fetchauthor($a, $item) {
|
||||||
|
|
||||||
// Skip if it isn't a pure repeated messages
|
// Skip if it isn't a pure repeated messages
|
||||||
// Does it start with a share?
|
// Does it start with a share?
|
||||||
if (!$skip AND strpos($body, "[share") > 0) {
|
if (!$skip && strpos($body, "[share") > 0) {
|
||||||
$skip = true;
|
$skip = true;
|
||||||
}
|
}
|
||||||
// Does it end with a share?
|
// Does it end with a share?
|
||||||
if (!$skip AND (strlen($body) > (strrpos($body, "[/share]") + 8))) {
|
if (!$skip && (strlen($body) > (strrpos($body, "[/share]") + 8))) {
|
||||||
$skip = true;
|
$skip = true;
|
||||||
}
|
}
|
||||||
if (!$skip) {
|
if (!$skip) {
|
||||||
|
@ -209,9 +221,6 @@ function display_content(App $a, $update = 0) {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'), array());
|
|
||||||
|
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
$nick = $_REQUEST['nick'];
|
$nick = $_REQUEST['nick'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -265,7 +274,7 @@ function display_content(App $a, $update = 0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item_id AND !is_numeric($item_id)) {
|
if ($item_id && !is_numeric($item_id)) {
|
||||||
$r = qu("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
$r = qu("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
dbesc($item_id), intval($a->profile['uid']));
|
dbesc($item_id), intval($a->profile['uid']));
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($r)) {
|
||||||
|
@ -281,6 +290,16 @@ function display_content(App $a, $update = 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We are displaying an "alternate" link if that post was public. See issue 2864
|
||||||
|
$items = q("SELECT `id` FROM `item` WHERE `id` = %d AND NOT `private` AND `wall`", intval($item_id));
|
||||||
|
if (dbm::is_result($items)) {
|
||||||
|
$alternate = App::get_baseurl().'/display/'.$nick.'/'.$item_id.'.atom';
|
||||||
|
} else {
|
||||||
|
$alternate = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$a->page['htmlhead'] .= replace_macros(get_markup_template('display-head.tpl'),
|
||||||
|
array('$alternate' => $alternate));
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ function events_content(App $a) {
|
||||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ');
|
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && (! $orig_event['allow_gid']) && (! $orig_event['deny_cid']) && (! $orig_event['deny_gid'])) ? '' : ' checked="checked" ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid OR ($mode !== 'new')) {
|
if ($cid || ($mode !== 'new')) {
|
||||||
$sh_checked .= ' disabled="disabled" ';
|
$sh_checked .= ' disabled="disabled" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ require_once("include/xml.php");
|
||||||
|
|
||||||
function fetch_init(App $a) {
|
function fetch_init(App $a) {
|
||||||
|
|
||||||
if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
|
if (($a->argc != 3) || (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user