Merge remote-tracking branch 'upstream/develop' into item-thread
This commit is contained in:
commit
4ae37c6196
306 changed files with 30223 additions and 24639 deletions
131
CHANGELOG
131
CHANGELOG
|
@ -1,3 +1,134 @@
|
||||||
|
Version 2018.09 (2018-09-23)
|
||||||
|
Friendica Core:
|
||||||
|
Update to the translation (CS, DE, EN-US, FI, IT, NL, PL, ZH-CN) [translation teams]
|
||||||
|
Update to the documentation [Aditoo17, annando, astifter, rebeka-catalina, fabrixxm, M-arcus, microgroove, nupplaphil, tobiasd]
|
||||||
|
Enhancements to the database structure, handling and documentation [abanink, Angristan, annando, miqrogroove, tobiasd]
|
||||||
|
Enhancements of unit testing [abanink, nupplaphil, rudloff]
|
||||||
|
Enhancements to labelling of UI elements [andyhee, tobiasd]
|
||||||
|
Enhancements to the background workers [annando, miqrogroove, rabuzarus]
|
||||||
|
Enhancements to the PHP7.2 compatibility [annando, miqrogroove, MrPetovan]
|
||||||
|
Enhancements to the content filter [MrPetovan]
|
||||||
|
Enhancements to the hooks provided for addons [abanink]
|
||||||
|
Enhancements to the interaction with public postings [annando]
|
||||||
|
Enhancements to the config storage [frabrixxm]
|
||||||
|
Enhancements to the themes (frio, quattro, smoothly, vier) [annando, astifter, hoergen, MrPetovan, rabuzarus, tobiasd]
|
||||||
|
Enhancements to the handling of locks [nupplaphil]
|
||||||
|
Enhancements to the redis integration [nupplaphil]
|
||||||
|
Enhancements to the admin panel [JeroenED, tobiasd]
|
||||||
|
Enhancements to the user import process [annando]
|
||||||
|
Enhancements to the display of invitation information [JeroenED]
|
||||||
|
Enhancements to the automatic installation process [nupplaphil]
|
||||||
|
Enhancements to the contact group UI [annando, astifter]
|
||||||
|
Enhancements to the call of JS [hypolite]
|
||||||
|
Enhancements to the storage of items in the database [annando]
|
||||||
|
Enhancements to the process of changing relationships [annando]
|
||||||
|
Enhancements to the OEmbed of data [MrPetovan]
|
||||||
|
Fixed various PHP notice occurrences [annando, MrPetovan]
|
||||||
|
Fixed a bug that could lead to the display of posts from deleted accounts on the community page for a short period [annando]
|
||||||
|
Fixed a bug that prevented email notification to be send out [annando]
|
||||||
|
Fixed a bug in database optimisation [annando]
|
||||||
|
Fixed a bug during removing contacts [annando]
|
||||||
|
Fixed a bug in the tag-cloud widget [annando]
|
||||||
|
Fixed a bug in the daemon mode of the background worker [annando]
|
||||||
|
Fixed a bug in the frio theme that contact filtering [rabuzarus]
|
||||||
|
Fixed a bug that mangled the display of some additional smileys [abanink]
|
||||||
|
Fixed a bug in generating registration mails [MrPetovan]
|
||||||
|
Fixed a bug that caused blank re-share bodies [MrPetovon]
|
||||||
|
Fixed a bug in the API handling of private mails [fabrixxm]
|
||||||
|
Fixed a bug when calling the mail() function [miqrogroove]
|
||||||
|
Fixed a bug that caused deleted accounts being displayed in the local directory [miqrogroove]
|
||||||
|
Fixed a bug when checking the domain of an email address [VVelox]
|
||||||
|
Fixed a bug that prevented re-shares from Twitter to be shown as this [annando]
|
||||||
|
Fixed a bug that caused broken profile links [miqrogroove]
|
||||||
|
Fixed a bug that caused content from unknown accounts appearing in the timeline [annando]
|
||||||
|
Fixed a bug with the ignoring and blocking of contacts [annando]
|
||||||
|
Fixed a bug with showing hidden contacts in some places [annando]
|
||||||
|
Fixed a bug that prevented the deletion of events by contacts [annando]
|
||||||
|
Fixed a bug that prevented email contacts from being added [annando]
|
||||||
|
Fixed a bug in the notification/seen API call [fabrixxm]
|
||||||
|
Fixed a bug that prevented a refresh after un-/ignoring a conversation [annando]
|
||||||
|
Fixed a bug in the handling of some language translations [anndno]
|
||||||
|
Fixed a bug in the hook handling [annando]
|
||||||
|
Fixed the handling of too long tags [annando]
|
||||||
|
Fixed a bug that prevented the unliking of dis-/likes [annando]
|
||||||
|
Fixed bugs with the handling of private nodes [annando]
|
||||||
|
Fixed a bug in the session initialisation [annando]
|
||||||
|
Fixed bugs in the execution of the background processes [annando, Quix0r]
|
||||||
|
Fixed a problem with the notification page [MrPetovan]
|
||||||
|
Fixed a bug with wrong dates in importing some Atom feeds [annando]
|
||||||
|
Fixed forum exclusive distribution of postings using the !notation [annando]
|
||||||
|
Fixed a bug that lead to empty notifications [MrPetovan]
|
||||||
|
Fixed a problem that could sometimes prevent the execution of the relocation [annando]
|
||||||
|
Fixed a bug with the handling of images in postings over the connectors [annando]
|
||||||
|
Added conversation cleanup configuration [miqrogroove]
|
||||||
|
Added support of the usage of internal diaspora links to accounts [annando]
|
||||||
|
Added the possibility for admins to block certain nicknames (e.g. role names) [tobiasd]
|
||||||
|
Added the generation of system guid [nupplaphil]
|
||||||
|
Added the possibility for admins to mark a node for explicit content [tobiasd]
|
||||||
|
Added filter by account type to the community page [annando]
|
||||||
|
Added private flag to API results [fabrixxm]
|
||||||
|
Added post update checks to the console utility [annando]
|
||||||
|
Added codecov analysis [nupplaphil]
|
||||||
|
Added access-keys to the frio theme [tobiasd]
|
||||||
|
Added the profile settings to the user settings [tobiasd]
|
||||||
|
General code refactoring and beautification work [annando, MrPetovan, Quix0r, tobiasd]
|
||||||
|
Fixation of the position on the network page when new posts arrive [rabuzarus]
|
||||||
|
Ported OpenWebAuth from Hubzilla [annando, rabuzarus]
|
||||||
|
Removed hard coded syntax highlighting from code blocks [MrPetovan]
|
||||||
|
Removed (temporarily) the possibility to add pictures to private messages [annando]
|
||||||
|
New INI style config file format in /config [MrPetovan, tobiasd]
|
||||||
|
The .htaccess file is not part of the git repository anymore [annando, Quix0r]
|
||||||
|
|
||||||
|
Friendica Addons:
|
||||||
|
Update to the translations (CS, DE, EN-US, NL, PL, ZH-CN) [translation teams]
|
||||||
|
General update to adopt changes in core [annando, MrPetovan, Quix0r, tobiasd]
|
||||||
|
advancedcontentfilter:
|
||||||
|
Enhancement to the error handling [MrPetovan]
|
||||||
|
Honour the CSP settings [MrPetovan]
|
||||||
|
Fixed translation problems [annando]
|
||||||
|
blockem:
|
||||||
|
Enhancement of the settings [AlfredSK]
|
||||||
|
buffer:
|
||||||
|
support for app.net removed [annando]
|
||||||
|
js_upload:
|
||||||
|
Enhancement of the album name handling [rabuzarus]
|
||||||
|
Enhancement to the wording of the labels [astifter]
|
||||||
|
langfilter:
|
||||||
|
Fixed a problem with default values of the filtered languages [tobiasd]
|
||||||
|
libravatar:
|
||||||
|
The service wont shutdown, so we can keep the addon [tobiasd]
|
||||||
|
pumpio:
|
||||||
|
Fixed a problem that prevented new connections [annando]
|
||||||
|
superblock:
|
||||||
|
Fixed a bug that prevented the addon to block accounts [annando]
|
||||||
|
Enhancements of the settings [AlfredSK]
|
||||||
|
twitter:
|
||||||
|
Use rich text for quote tweets [MrPetovan]
|
||||||
|
Prevent empty quotes from being created [annando]
|
||||||
|
Fixed a problem with re-shares from remote_self contacts [annando]
|
||||||
|
Changed URL display after link expansion [MrPetovan]
|
||||||
|
Fixed a problem with EXIF handling [MrPetovan]
|
||||||
|
added addons:
|
||||||
|
mastodoncustomemojis [MrPetovan]
|
||||||
|
deprecated addons:
|
||||||
|
notimeline, retriver, remote_permissions, widgets
|
||||||
|
|
||||||
|
Directory:
|
||||||
|
Enhancements of the health summary [andyhee]
|
||||||
|
Enhancements of the PHP7 compatibility [MrPetovan]
|
||||||
|
|
||||||
|
Closed Issues:
|
||||||
|
901, 1034, 1074, 1303, 1308, 1391, 1490, 1470, 1559, 2093, 2337,
|
||||||
|
2340, 2381, 2396, 2675, 3291, 3299, 3493, 3501, 3535, 3643, 3840,
|
||||||
|
4148, 4419, 4475, 4507, 4655, 4659, 4710, 4726, 4739, 4753, 4814,
|
||||||
|
4830, 4868, 4889, 4923, 4971, 4950, 4985, 5066, 5099, 5137, 5148,
|
||||||
|
5158, 5168, 5188, 5202, 5211, 5222, 5233, 5243, 5247, 5252, 5257,
|
||||||
|
5260, 5262, 5268, 5274, 5275, 5276, 5278, 5298, 5318, 5319, 5320,
|
||||||
|
5321, 5322, 5330, 5333, 5341, 5365, 5405, 5407, 5411, 5423, 5432,
|
||||||
|
5434, 5436, 5443, 5455, 5464, 5467, 5469, 5486, 5496, 5497, 5514,
|
||||||
|
5539, 5524, 5541, 5544, 5550, 5564, 5566, 5605, 5630, 5638, 5651,
|
||||||
|
5653, 5660, 5670, 5691, 5733, 5745, 5768
|
||||||
|
|
||||||
Version 2018.05 (2018-06-01)
|
Version 2018.05 (2018-06-01)
|
||||||
Friendica Core:
|
Friendica Core:
|
||||||
Update to the translations (DE, EN-GB, EN-US, FI, IS, IT, NL, PL, RU, ZN CH) [translation teams]
|
Update to the translations (DE, EN-GB, EN-US, FI, IS, IT, NL, PL, RU, ZN CH) [translation teams]
|
||||||
|
|
|
@ -56,6 +56,13 @@ you wish to communicate with the Diaspora network.
|
||||||
- For alternative server configurations (such as Nginx server and MariaDB
|
- For alternative server configurations (such as Nginx server and MariaDB
|
||||||
database engine), refer to the wiki at https://github.com/friendica/friendica/wiki
|
database engine), refer to the wiki at https://github.com/friendica/friendica/wiki
|
||||||
|
|
||||||
|
This guide will walk you through the manual installation process of Friendica.
|
||||||
|
If this is nothing for you, you might be interested in
|
||||||
|
|
||||||
|
* the Friendica Docker image (https://github.com/friendica/docker) or
|
||||||
|
* how install Friendica with YunoHost (https://github.com/YunoHost-Apps/friendica_ynh).
|
||||||
|
|
||||||
|
|
||||||
2. Unpack the Friendica files into the root of your web server document area.
|
2. Unpack the Friendica files into the root of your web server document area.
|
||||||
|
|
||||||
- If you copy the directory tree to your webserver, make sure
|
- If you copy the directory tree to your webserver, make sure
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2018.08-rc
|
2018.12-dev
|
||||||
|
|
|
@ -54,7 +54,7 @@ require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
if ($a->mode === App::MODE_NORMAL) {
|
if ($a->getMode()->isNormal()) {
|
||||||
$oAuth = new ExAuth();
|
$oAuth = new ExAuth();
|
||||||
$oAuth->readStdin();
|
$oAuth->readStdin();
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -34,7 +34,7 @@ require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
|
|
||||||
if ($a->isInstallMode()) {
|
if ($a->getMode()->isInstall()) {
|
||||||
die("Friendica isn't properly installed yet.\n");
|
die("Friendica isn't properly installed yet.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ if (Config::get('system', 'maintenance', false, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_baseurl(Config::get('system', 'url'));
|
$a->setBaseURL(Config::get('system', 'url'));
|
||||||
|
|
||||||
Addon::loadHooks();
|
Addon::loadHooks();
|
||||||
|
|
||||||
|
|
164
boot.php
164
boot.php
|
@ -39,9 +39,9 @@ require_once 'include/text.php';
|
||||||
|
|
||||||
define('FRIENDICA_PLATFORM', 'Friendica');
|
define('FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
|
define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily');
|
||||||
define('FRIENDICA_VERSION', '2018.08-rc');
|
define('FRIENDICA_VERSION', '2018.12-dev');
|
||||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||||
define('DB_UPDATE_VERSION', 1283);
|
define('DB_UPDATE_VERSION', 1288);
|
||||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -475,44 +475,6 @@ function defaults() {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the baseurl.
|
|
||||||
*
|
|
||||||
* @see System::baseUrl()
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @TODO Function is deprecated and only used in some addons
|
|
||||||
*/
|
|
||||||
function z_root()
|
|
||||||
{
|
|
||||||
return System::baseUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Return absolut URL for given $path.
|
|
||||||
*
|
|
||||||
* @param string $path given path
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function absurl($path)
|
|
||||||
{
|
|
||||||
if (strpos($path, '/') === 0) {
|
|
||||||
return z_path() . $path;
|
|
||||||
}
|
|
||||||
return $path;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
function is_ajax()
|
|
||||||
{
|
|
||||||
return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
* @brief Function to check if request was an AJAX (xmlhttprequest) request.
|
||||||
*
|
*
|
||||||
|
@ -556,7 +518,7 @@ function check_url(App $a)
|
||||||
// and www.example.com vs example.com.
|
// and www.example.com vs example.com.
|
||||||
// We will only change the url to an ip address if there is no existing setting
|
// We will only change the url to an ip address if there is no existing setting
|
||||||
|
|
||||||
if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->get_hostname()))) {
|
if (empty($url) || (!link_compare($url, System::baseUrl())) && (!preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/", $a->getHostName()))) {
|
||||||
Config::set('system', 'url', System::baseUrl());
|
Config::set('system', 'url', System::baseUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -673,62 +635,6 @@ function run_update_function($x, $prefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Synchronise addons:
|
|
||||||
*
|
|
||||||
* system.addon contains a comma-separated list of names
|
|
||||||
* of addons which are used on this system.
|
|
||||||
* Go through the database list of already installed addons, and if we have
|
|
||||||
* an entry, but it isn't in the config list, call the uninstall procedure
|
|
||||||
* and mark it uninstalled in the database (for now we'll remove it).
|
|
||||||
* Then go through the config list and if we have a addon that isn't installed,
|
|
||||||
* call the install procedure and add it to the database.
|
|
||||||
*
|
|
||||||
* @param object $a App
|
|
||||||
*/
|
|
||||||
function check_addons(App $a)
|
|
||||||
{
|
|
||||||
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
|
|
||||||
if (DBA::isResult($r)) {
|
|
||||||
$installed = $r;
|
|
||||||
} else {
|
|
||||||
$installed = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$addons = Config::get('system', 'addon');
|
|
||||||
$addons_arr = [];
|
|
||||||
|
|
||||||
if ($addons) {
|
|
||||||
$addons_arr = explode(',', str_replace(' ', '', $addons));
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->addons = $addons_arr;
|
|
||||||
|
|
||||||
$installed_arr = [];
|
|
||||||
|
|
||||||
if (count($installed)) {
|
|
||||||
foreach ($installed as $i) {
|
|
||||||
if (!in_array($i['name'], $addons_arr)) {
|
|
||||||
Addon::uninstall($i['name']);
|
|
||||||
} else {
|
|
||||||
$installed_arr[] = $i['name'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (count($addons_arr)) {
|
|
||||||
foreach ($addons_arr as $p) {
|
|
||||||
if (!in_array($p, $installed_arr)) {
|
|
||||||
Addon::install($p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Addon::loadHooks();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Used to end the current process, after saving session state.
|
* @brief Used to end the current process, after saving session state.
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -741,7 +647,7 @@ function killme()
|
||||||
/**
|
/**
|
||||||
* @brief Redirect to another URL and terminate this process.
|
* @brief Redirect to another URL and terminate this process.
|
||||||
*/
|
*/
|
||||||
function goaway($path)
|
function goaway($path = '')
|
||||||
{
|
{
|
||||||
if (strstr(normalise_link($path), 'http://')) {
|
if (strstr(normalise_link($path), 'http://')) {
|
||||||
$url = $path;
|
$url = $path;
|
||||||
|
@ -1031,27 +937,27 @@ function get_temppath()
|
||||||
|
|
||||||
$temppath = Config::get("system", "temppath");
|
$temppath = Config::get("system", "temppath");
|
||||||
|
|
||||||
if (($temppath != "") && App::directory_usable($temppath)) {
|
if (($temppath != "") && App::isDirectoryUsable($temppath)) {
|
||||||
// We have a temp path and it is usable
|
// We have a temp path and it is usable
|
||||||
return App::realpath($temppath);
|
return App::getRealPath($temppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't have a working preconfigured temp path, so we take the system path.
|
// We don't have a working preconfigured temp path, so we take the system path.
|
||||||
$temppath = sys_get_temp_dir();
|
$temppath = sys_get_temp_dir();
|
||||||
|
|
||||||
// Check if it is usable
|
// Check if it is usable
|
||||||
if (($temppath != "") && App::directory_usable($temppath)) {
|
if (($temppath != "") && App::isDirectoryUsable($temppath)) {
|
||||||
// Always store the real path, not the path through symlinks
|
// Always store the real path, not the path through symlinks
|
||||||
$temppath = App::realpath($temppath);
|
$temppath = App::getRealPath($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->getHostName();
|
||||||
if (!is_dir($new_temppath)) {
|
if (!is_dir($new_temppath)) {
|
||||||
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
||||||
mkdir($new_temppath);
|
mkdir($new_temppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App::directory_usable($new_temppath)) {
|
if (App::isDirectoryUsable($new_temppath)) {
|
||||||
// The new path is usable, we are happy
|
// The new path is usable, we are happy
|
||||||
Config::set("system", "temppath", $new_temppath);
|
Config::set("system", "temppath", $new_temppath);
|
||||||
return $new_temppath;
|
return $new_temppath;
|
||||||
|
@ -1133,8 +1039,8 @@ function get_itemcachepath()
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemcache = Config::get('system', 'itemcache');
|
$itemcache = Config::get('system', 'itemcache');
|
||||||
if (($itemcache != "") && App::directory_usable($itemcache)) {
|
if (($itemcache != "") && App::isDirectoryUsable($itemcache)) {
|
||||||
return App::realpath($itemcache);
|
return App::getRealPath($itemcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
$temppath = get_temppath();
|
$temppath = get_temppath();
|
||||||
|
@ -1145,7 +1051,7 @@ function get_itemcachepath()
|
||||||
mkdir($itemcache);
|
mkdir($itemcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App::directory_usable($itemcache)) {
|
if (App::isDirectoryUsable($itemcache)) {
|
||||||
Config::set("system", "itemcache", $itemcache);
|
Config::set("system", "itemcache", $itemcache);
|
||||||
return $itemcache;
|
return $itemcache;
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1067,7 @@ function get_itemcachepath()
|
||||||
function get_spoolpath()
|
function get_spoolpath()
|
||||||
{
|
{
|
||||||
$spoolpath = Config::get('system', 'spoolpath');
|
$spoolpath = Config::get('system', 'spoolpath');
|
||||||
if (($spoolpath != "") && App::directory_usable($spoolpath)) {
|
if (($spoolpath != "") && App::isDirectoryUsable($spoolpath)) {
|
||||||
// We have a spool path and it is usable
|
// We have a spool path and it is usable
|
||||||
return $spoolpath;
|
return $spoolpath;
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1082,7 @@ function get_spoolpath()
|
||||||
mkdir($spoolpath);
|
mkdir($spoolpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (App::directory_usable($spoolpath)) {
|
if (App::isDirectoryUsable($spoolpath)) {
|
||||||
// The new path is usable, we are happy
|
// The new path is usable, we are happy
|
||||||
Config::set("system", "spoolpath", $spoolpath);
|
Config::set("system", "spoolpath", $spoolpath);
|
||||||
return $spoolpath;
|
return $spoolpath;
|
||||||
|
@ -1231,46 +1137,6 @@ function validate_include(&$file)
|
||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
function current_load()
|
|
||||||
{
|
|
||||||
if (!function_exists('sys_getloadavg')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$load_arr = sys_getloadavg();
|
|
||||||
|
|
||||||
if (!is_array($load_arr)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return max($load_arr[0], $load_arr[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief get c-style args
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function argc()
|
|
||||||
{
|
|
||||||
return get_app()->argc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Returns the value of a argv key
|
|
||||||
*
|
|
||||||
* @param int $x argv key
|
|
||||||
* @return string Value of the argv key
|
|
||||||
*/
|
|
||||||
function argv($x)
|
|
||||||
{
|
|
||||||
if (array_key_exists($x, get_app()->argv)) {
|
|
||||||
return get_app()->argv[$x];
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the data which is needed for infinite scroll
|
* @brief Get the data which is needed for infinite scroll
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
"asika/simple-console": "^1.0",
|
"asika/simple-console": "^1.0",
|
||||||
"divineomega/password_exposed": "^2.4",
|
"divineomega/password_exposed": "^2.4",
|
||||||
"ezyang/htmlpurifier": "~4.7.0",
|
"ezyang/htmlpurifier": "~4.7.0",
|
||||||
"league/html-to-markdown": "~4.4.1",
|
"friendica/json-ld": "^1.0",
|
||||||
|
"league/html-to-markdown": "~4.8.0",
|
||||||
"lightopenid/lightopenid": "dev-master",
|
"lightopenid/lightopenid": "dev-master",
|
||||||
"michelf/php-markdown": "^1.7",
|
"michelf/php-markdown": "^1.7",
|
||||||
"mobiledetect/mobiledetectlib": "2.8.*",
|
"mobiledetect/mobiledetectlib": "2.8.*",
|
||||||
"paragonie/random_compat": "^2.0",
|
"paragonie/random_compat": "^2.0",
|
||||||
"pear/Text_LanguageDetect": "1.*",
|
"pear/Text_LanguageDetect": "1.*",
|
||||||
"pear/Text_Highlighter": "dev-master",
|
|
||||||
"seld/cli-prompt": "^1.0",
|
"seld/cli-prompt": "^1.0",
|
||||||
"smarty/smarty": "^3.1",
|
"smarty/smarty": "^3.1",
|
||||||
"fxp/composer-asset-plugin": "~1.3",
|
"fxp/composer-asset-plugin": "~1.3",
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/pear/Text_Highlighter"
|
"url": "https://git.friendi.ca/friendica/php-json-ld"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -75,7 +75,8 @@
|
||||||
"phpunit/dbunit": "^2.0",
|
"phpunit/dbunit": "^2.0",
|
||||||
"phpdocumentor/reflection-docblock": "^3.0.2",
|
"phpdocumentor/reflection-docblock": "^3.0.2",
|
||||||
"phpunit/php-token-stream": "^1.4.2",
|
"phpunit/php-token-stream": "^1.4.2",
|
||||||
"mikey179/vfsStream": "^1.6"
|
"mikey179/vfsStream": "^1.6",
|
||||||
|
"mockery/mockery": "^1.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "phpunit"
|
"test": "phpunit"
|
||||||
|
|
979
composer.lock
generated
979
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -140,6 +140,10 @@ disable_url_validation = false
|
||||||
; Disable the exposition check against the remote haveibeenpwned API on password change.
|
; Disable the exposition check against the remote haveibeenpwned API on password change.
|
||||||
disable_password_exposed = false
|
disable_password_exposed = false
|
||||||
|
|
||||||
|
; disable_polling (Boolean)
|
||||||
|
; Disable the polling of DFRN and OStatus contacts through onepoll.php.
|
||||||
|
disable_polling = false
|
||||||
|
|
||||||
; dlogfile (Path)
|
; dlogfile (Path)
|
||||||
; location of the developer log file.
|
; location of the developer log file.
|
||||||
dlogfile =
|
dlogfile =
|
||||||
|
|
|
@ -15,6 +15,34 @@
|
||||||
"name": ["UNIQUE", "name"]
|
"name": ["UNIQUE", "name"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"apcontact": {
|
||||||
|
"comment": "ActivityPub compatible contacts - used in the ActivityPub implementation",
|
||||||
|
"fields": {
|
||||||
|
"url": {"type": "varbinary(255)", "not null": "1", "primary": "1", "comment": "URL of the contact"},
|
||||||
|
"uuid": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"type": {"type": "varchar(20)", "not null": "1", "comment": ""},
|
||||||
|
"following": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"followers": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"inbox": {"type": "varchar(255)", "not null": "1", "comment": ""},
|
||||||
|
"outbox": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"sharedinbox": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"nick": {"type": "varchar(255)", "not null": "1", "default": "", "comment": ""},
|
||||||
|
"name": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"about": {"type": "text", "comment": ""},
|
||||||
|
"photo": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"addr": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"alias": {"type": "varchar(255)", "comment": ""},
|
||||||
|
"pubkey": {"type": "text", "comment": ""},
|
||||||
|
"baseurl": {"type": "varchar(255)", "comment": "baseurl of the ap contact"},
|
||||||
|
"updated": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": ""}
|
||||||
|
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"PRIMARY": ["url"],
|
||||||
|
"addr": ["addr(32)"],
|
||||||
|
"url": ["followers(190)"]
|
||||||
|
}
|
||||||
|
},
|
||||||
"attach": {
|
"attach": {
|
||||||
"comment": "file attachments",
|
"comment": "file attachments",
|
||||||
"fields": {
|
"fields": {
|
||||||
|
@ -164,6 +192,7 @@
|
||||||
"hidden": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
|
"hidden": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
|
||||||
"archive": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
|
"archive": {"type": "boolean", "not null": "1", "default": "0", "comment": ""},
|
||||||
"pending": {"type": "boolean", "not null": "1", "default": "1", "comment": ""},
|
"pending": {"type": "boolean", "not null": "1", "default": "1", "comment": ""},
|
||||||
|
"deleted": {"type": "boolean", "not null": "1", "default": "0", "comment": "Contact has been deleted"},
|
||||||
"rating": {"type": "tinyint", "not null": "1", "default": "0", "comment": ""},
|
"rating": {"type": "tinyint", "not null": "1", "default": "0", "comment": ""},
|
||||||
"reason": {"type": "text", "comment": ""},
|
"reason": {"type": "text", "comment": ""},
|
||||||
"closeness": {"type": "tinyint unsigned", "not null": "1", "default": "99", "comment": ""},
|
"closeness": {"type": "tinyint unsigned", "not null": "1", "default": "99", "comment": ""},
|
||||||
|
@ -215,7 +244,7 @@
|
||||||
"reply-to-uri": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "URI to which this item is a reply"},
|
"reply-to-uri": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "URI to which this item is a reply"},
|
||||||
"conversation-uri": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "GNU Social conversation URI"},
|
"conversation-uri": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "GNU Social conversation URI"},
|
||||||
"conversation-href": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "GNU Social conversation link"},
|
"conversation-href": {"type": "varbinary(255)", "not null": "1", "default": "", "comment": "GNU Social conversation link"},
|
||||||
"protocol": {"type": "tinyint unsigned", "not null": "1", "default": "0", "comment": "The protocol of the item"},
|
"protocol": {"type": "tinyint unsigned", "not null": "1", "default": "255", "comment": "The protocol of the item"},
|
||||||
"source": {"type": "mediumtext", "comment": "Original source"},
|
"source": {"type": "mediumtext", "comment": "Original source"},
|
||||||
"received": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Receiving date"}
|
"received": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Receiving date"}
|
||||||
},
|
},
|
||||||
|
@ -225,6 +254,16 @@
|
||||||
"received": ["received"]
|
"received": ["received"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"diaspora-interaction": {
|
||||||
|
"comment": "Signed Diaspora Interaction",
|
||||||
|
"fields": {
|
||||||
|
"uri-id": {"type": "int unsigned", "not null": "1", "primary": "1", "relation": {"item-uri": "id"}, "comment": "Id of the item-uri table entry that contains the item uri"},
|
||||||
|
"interaction": {"type": "mediumtext", "comment": "The Diaspora interaction"}
|
||||||
|
},
|
||||||
|
"indexes": {
|
||||||
|
"PRIMARY": ["uri-id"]
|
||||||
|
}
|
||||||
|
},
|
||||||
"event": {
|
"event": {
|
||||||
"comment": "Events",
|
"comment": "Events",
|
||||||
"fields": {
|
"fields": {
|
||||||
|
@ -581,7 +620,8 @@
|
||||||
"indexes": {
|
"indexes": {
|
||||||
"PRIMARY": ["id"],
|
"PRIMARY": ["id"],
|
||||||
"uri-hash": ["UNIQUE", "uri-hash"],
|
"uri-hash": ["UNIQUE", "uri-hash"],
|
||||||
"uri": ["uri(191)"]
|
"uri": ["uri(191)"],
|
||||||
|
"uri-id": ["uri-id"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"item-content": {
|
"item-content": {
|
||||||
|
@ -610,7 +650,8 @@
|
||||||
"indexes": {
|
"indexes": {
|
||||||
"PRIMARY": ["id"],
|
"PRIMARY": ["id"],
|
||||||
"uri-plink-hash": ["UNIQUE", "uri-plink-hash"],
|
"uri-plink-hash": ["UNIQUE", "uri-plink-hash"],
|
||||||
"uri": ["uri(191)"]
|
"uri": ["uri(191)"],
|
||||||
|
"uri-id": ["uri-id"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"item-delivery-data": {
|
"item-delivery-data": {
|
||||||
|
@ -1269,14 +1310,16 @@
|
||||||
"created": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Creation date"},
|
"created": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Creation date"},
|
||||||
"pid": {"type": "int unsigned", "not null": "1", "default": "0", "comment": "Process id of the worker"},
|
"pid": {"type": "int unsigned", "not null": "1", "default": "0", "comment": "Process id of the worker"},
|
||||||
"executed": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Execution date"},
|
"executed": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Execution date"},
|
||||||
|
"next_try": {"type": "datetime", "not null": "1", "default": "0001-01-01 00:00:00", "comment": "Next retrial date"},
|
||||||
|
"retrial": {"type": "tinyint", "not null": "1", "default": "0", "comment": "Retrial counter"},
|
||||||
"done": {"type": "boolean", "not null": "1", "default": "0", "comment": "Marked 1 when the task was done - will be deleted later"}
|
"done": {"type": "boolean", "not null": "1", "default": "0", "comment": "Marked 1 when the task was done - will be deleted later"}
|
||||||
},
|
},
|
||||||
"indexes": {
|
"indexes": {
|
||||||
"PRIMARY": ["id"],
|
"PRIMARY": ["id"],
|
||||||
"pid": ["pid"],
|
"pid": ["pid"],
|
||||||
"parameter": ["parameter(64)"],
|
"parameter": ["parameter(64)"],
|
||||||
"priority_created": ["priority", "created"],
|
"priority_created_next_try": ["priority", "created", "next_try"],
|
||||||
"done_executed": ["done", "executed"]
|
"done_executed_next_try": ["done", "executed", "next_try"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
48
database.sql
48
database.sql
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2018.08-dev (The Tazmans Flax-lily)
|
-- Friendica 2018.12-dev (The Tazmans Flax-lily)
|
||||||
-- DB_UPDATE_VERSION 1283
|
-- DB_UPDATE_VERSION 1287
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,32 @@ CREATE TABLE IF NOT EXISTS `addon` (
|
||||||
UNIQUE INDEX `name` (`name`)
|
UNIQUE INDEX `name` (`name`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='registered addons';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TABLE apcontact
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS `apcontact` (
|
||||||
|
`url` varbinary(255) NOT NULL COMMENT 'URL of the contact',
|
||||||
|
`uuid` varchar(255) COMMENT '',
|
||||||
|
`type` varchar(20) NOT NULL COMMENT '',
|
||||||
|
`following` varchar(255) COMMENT '',
|
||||||
|
`followers` varchar(255) COMMENT '',
|
||||||
|
`inbox` varchar(255) NOT NULL COMMENT '',
|
||||||
|
`outbox` varchar(255) COMMENT '',
|
||||||
|
`sharedinbox` varchar(255) COMMENT '',
|
||||||
|
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||||
|
`name` varchar(255) COMMENT '',
|
||||||
|
`about` text COMMENT '',
|
||||||
|
`photo` varchar(255) COMMENT '',
|
||||||
|
`addr` varchar(255) COMMENT '',
|
||||||
|
`alias` varchar(255) COMMENT '',
|
||||||
|
`pubkey` text COMMENT '',
|
||||||
|
`baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
|
||||||
|
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
|
||||||
|
PRIMARY KEY(`url`),
|
||||||
|
INDEX `addr` (`addr`(32)),
|
||||||
|
INDEX `url` (`followers`(190))
|
||||||
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='ActivityPub compatible contacts - used in the ActivityPub implementation';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- TABLE attach
|
-- TABLE attach
|
||||||
--
|
--
|
||||||
|
@ -163,6 +189,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
|
||||||
`hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
|
`hidden` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||||
`archive` boolean NOT NULL DEFAULT '0' COMMENT '',
|
`archive` boolean NOT NULL DEFAULT '0' COMMENT '',
|
||||||
`pending` boolean NOT NULL DEFAULT '1' COMMENT '',
|
`pending` boolean NOT NULL DEFAULT '1' COMMENT '',
|
||||||
|
`deleted` boolean NOT NULL DEFAULT '0' COMMENT 'Contact has been deleted',
|
||||||
`rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
|
`rating` tinyint NOT NULL DEFAULT 0 COMMENT '',
|
||||||
`reason` text COMMENT '',
|
`reason` text COMMENT '',
|
||||||
`closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
|
`closeness` tinyint unsigned NOT NULL DEFAULT 99 COMMENT '',
|
||||||
|
@ -212,7 +239,7 @@ CREATE TABLE IF NOT EXISTS `conversation` (
|
||||||
`reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
|
`reply-to-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'URI to which this item is a reply',
|
||||||
`conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
|
`conversation-uri` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation URI',
|
||||||
`conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
|
`conversation-href` varbinary(255) NOT NULL DEFAULT '' COMMENT 'GNU Social conversation link',
|
||||||
`protocol` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The protocol of the item',
|
`protocol` tinyint unsigned NOT NULL DEFAULT 255 COMMENT 'The protocol of the item',
|
||||||
`source` mediumtext COMMENT 'Original source',
|
`source` mediumtext COMMENT 'Original source',
|
||||||
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
|
`received` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Receiving date',
|
||||||
PRIMARY KEY(`item-uri`),
|
PRIMARY KEY(`item-uri`),
|
||||||
|
@ -220,6 +247,15 @@ CREATE TABLE IF NOT EXISTS `conversation` (
|
||||||
INDEX `received` (`received`)
|
INDEX `received` (`received`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Raw data and structure information for messages';
|
||||||
|
|
||||||
|
--
|
||||||
|
-- TABLE diaspora-interaction
|
||||||
|
--
|
||||||
|
CREATE TABLE IF NOT EXISTS `diaspora-interaction` (
|
||||||
|
`uri-id` int unsigned NOT NULL COMMENT 'Id of the item-uri table entry that contains the item uri',
|
||||||
|
`interaction` mediumtext COMMENT 'The Diaspora interaction',
|
||||||
|
PRIMARY KEY(`uri-id`)
|
||||||
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Signed Diaspora Interaction';
|
||||||
|
|
||||||
--
|
--
|
||||||
-- TABLE event
|
-- TABLE event
|
||||||
--
|
--
|
||||||
|
@ -1215,12 +1251,14 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
|
||||||
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
|
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Creation date',
|
||||||
`pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
|
`pid` int unsigned NOT NULL DEFAULT 0 COMMENT 'Process id of the worker',
|
||||||
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
|
`executed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Execution date',
|
||||||
|
`next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
|
||||||
|
`retrial` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
|
||||||
`done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
|
`done` boolean NOT NULL DEFAULT '0' COMMENT 'Marked 1 when the task was done - will be deleted later',
|
||||||
PRIMARY KEY(`id`),
|
PRIMARY KEY(`id`),
|
||||||
INDEX `pid` (`pid`),
|
INDEX `pid` (`pid`),
|
||||||
INDEX `parameter` (`parameter`(64)),
|
INDEX `parameter` (`parameter`(64)),
|
||||||
INDEX `priority_created` (`priority`,`created`),
|
INDEX `priority_created_next_try` (`priority`,`created`,`next_try`),
|
||||||
INDEX `done_executed` (`done`,`executed`)
|
INDEX `done_executed_next_try` (`done`,`executed`,`next_try`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Background tasks queue entries';
|
||||||
|
|
||||||
|
|
||||||
|
|
101
doc/Addons.md
101
doc/Addons.md
|
@ -67,55 +67,67 @@ $b can be called anything you like.
|
||||||
This is information specific to the hook currently being processed, and generally contains information that is being immediately processed or acted on that you can use, display, or alter.
|
This is information specific to the hook currently being processed, and generally contains information that is being immediately processed or acted on that you can use, display, or alter.
|
||||||
Remember to declare it with `&` if you wish to alter it.
|
Remember to declare it with `&` if you wish to alter it.
|
||||||
|
|
||||||
## JavaScript addon hooks
|
## Global stylesheets
|
||||||
|
|
||||||
### PHP part
|
If your addon requires adding a stylesheet on all pages of Friendica, add the following hook:
|
||||||
|
|
||||||
Make sure your JavaScript addon file (addon/*addon_name*/*addon_name*.js) is listed in the document response.
|
|
||||||
|
|
||||||
In your addon install function, add:
|
|
||||||
|
|
||||||
```php
|
```php
|
||||||
Addon::registerHook('template_vars', __FILE__, '<addon_name>_template_vars');
|
function <addon>_install()
|
||||||
```
|
|
||||||
|
|
||||||
In your addon uninstall function, add:
|
|
||||||
|
|
||||||
```php
|
|
||||||
Addon::unregisterHook('template_vars', __FILE__, '<addon_name>_template_vars');
|
|
||||||
```
|
|
||||||
|
|
||||||
Then, add your addon name to the *addon_hooks* template variable array:
|
|
||||||
|
|
||||||
```php
|
|
||||||
function <addon_name>_template_vars($a, &$arr)
|
|
||||||
{
|
{
|
||||||
if (!array_key_exists('addon_hooks', $arr['vars']))
|
Addon::registerHook('head', __FILE__, '<addon>_head');
|
||||||
{
|
...
|
||||||
$arr['vars']['addon_hooks'] = array();
|
}
|
||||||
}
|
|
||||||
$arr['vars']['addon_hooks'][] = "<addon_name>";
|
|
||||||
|
function <addon>_head(App $a)
|
||||||
|
{
|
||||||
|
$a->registerStylesheet(__DIR__ . '/relative/path/to/addon/stylesheet.css');
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### JavaScript part
|
`__DIR__` is the folder path of your addon.
|
||||||
|
|
||||||
Register your addon hooks in file `addon/*addon_name*/*addon_name*.js`.
|
## JavaScript
|
||||||
|
|
||||||
|
### Global scripts
|
||||||
|
|
||||||
|
If your addon requires adding a script on all pages of Friendica, add the following hook:
|
||||||
|
|
||||||
|
|
||||||
|
```php
|
||||||
|
function <addon>_install()
|
||||||
|
{
|
||||||
|
Addon::registerHook('footer', __FILE__, '<addon>_footer');
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
function <addon>_footer(App $a)
|
||||||
|
{
|
||||||
|
$a->registerFooterScript(__DIR__ . '/relative/path/to/addon/script.js');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`__DIR__` is the folder path of your addon.
|
||||||
|
|
||||||
|
### JavaScript hooks
|
||||||
|
|
||||||
|
The main Friendica script provides hooks via events dispatched on the `document` property.
|
||||||
|
In your Javascript file included as described above, add your event listener like this:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
Addon_registerHook(type, hookfnstr);
|
document.addEventListener(name, callback);
|
||||||
```
|
```
|
||||||
|
|
||||||
*type* is the name of the hook and corresponds to a known Friendica JavaScript hook.
|
- *name* is the name of the hook and corresponds to a known Friendica JavaScript hook.
|
||||||
*hookfnstr* is the name of your JavaScript function to execute.
|
- *callback* is a JavaScript anonymous function to execute.
|
||||||
|
|
||||||
No arguments are provided to your JavaScript callback function. Example:
|
More info about Javascript event listeners: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
||||||
|
|
||||||
```javascript
|
#### Current JavaScript hooks
|
||||||
function myhook_function() {
|
|
||||||
|
|
||||||
}
|
##### postprocess_liveupdate
|
||||||
```
|
Called at the end of the live update process (XmlHttpRequest) and on a post preview.
|
||||||
|
No additional data is provided.
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
||||||
|
@ -260,6 +272,11 @@ Called after conversion of bbcode to HTML.
|
||||||
Called after tag conversion of HTML to bbcode (e.g. remote message posting)
|
Called after tag conversion of HTML to bbcode (e.g. remote message posting)
|
||||||
`$b` is a string converted text
|
`$b` is a string converted text
|
||||||
|
|
||||||
|
### head
|
||||||
|
Called when building the `<head>` sections.
|
||||||
|
Stylesheets should be registered using this hook.
|
||||||
|
`$b` is an HTML string of the `<head>` tag.
|
||||||
|
|
||||||
### page_header
|
### page_header
|
||||||
Called after building the page navigation section.
|
Called after building the page navigation section.
|
||||||
`$b` is a string HTML of nav region.
|
`$b` is a string HTML of nav region.
|
||||||
|
@ -294,6 +311,11 @@ No hook data.
|
||||||
Called after HTML content functions have completed.
|
Called after HTML content functions have completed.
|
||||||
`$b` is (string) HTML of content div.
|
`$b` is (string) HTML of content div.
|
||||||
|
|
||||||
|
### footer
|
||||||
|
Called after HTML content functions have completed.
|
||||||
|
Deferred Javascript files should be registered using this hook.
|
||||||
|
`$b` is (string) HTML of footer div/element.
|
||||||
|
|
||||||
### avatar_lookup
|
### avatar_lookup
|
||||||
Called when looking up the avatar. `$b` is an array:
|
Called when looking up the avatar. `$b` is an array:
|
||||||
|
|
||||||
|
@ -389,14 +411,9 @@ Hook data:
|
||||||
visitor => array with the contact record of the visitor
|
visitor => array with the contact record of the visitor
|
||||||
url => the query string
|
url => the query string
|
||||||
|
|
||||||
## Current JavaScript hooks
|
|
||||||
|
|
||||||
### postprocess_liveupdate
|
|
||||||
Called at the end of the live update process (XmlHttpRequest)
|
|
||||||
|
|
||||||
## Complete list of hook callbacks
|
## Complete list of hook callbacks
|
||||||
|
|
||||||
Here is a complete list of all hook callbacks with file locations (as of 01-Apr-2018). Please see the source for details of any hooks not documented above.
|
Here is a complete list of all hook callbacks with file locations (as of 24-Sep-2018). Please see the source for details of any hooks not documented above.
|
||||||
|
|
||||||
### index.php
|
### index.php
|
||||||
|
|
||||||
|
@ -571,6 +588,8 @@ Here is a complete list of all hook callbacks with file locations (as of 01-Apr-
|
||||||
### src/App.php
|
### src/App.php
|
||||||
|
|
||||||
Addon::callHooks('load_config');
|
Addon::callHooks('load_config');
|
||||||
|
Addon::callHooks('head');
|
||||||
|
Addon::callHooks('footer');
|
||||||
|
|
||||||
### src/Model/Item.php
|
### src/Model/Item.php
|
||||||
|
|
||||||
|
@ -704,4 +723,4 @@ Here is a complete list of all hook callbacks with file locations (as of 01-Apr-
|
||||||
|
|
||||||
### view/js/main.js
|
### view/js/main.js
|
||||||
|
|
||||||
callAddonHooks("postprocess_liveupdate");
|
document.dispatchEvent(new Event('postprocess_liveupdate'));
|
||||||
|
|
|
@ -33,7 +33,7 @@ If you don't want to translate the UI, or it is already done to your satisfactio
|
||||||
Are you good at designing things?
|
Are you good at designing things?
|
||||||
If you have seen Friendica you probably have ideas to improve it, haven't you?
|
If you have seen Friendica you probably have ideas to improve it, haven't you?
|
||||||
|
|
||||||
* If you would like to work with us on enhancing the user interface, please join the [UX Watchdogs forum](https://fc.oscp.info/profile/ux-watchdogs)
|
* If you would like to work with us on enhancing the user interface, please join the [forum for Friendica development](https://forum.friendi.ca/profile/developers).
|
||||||
* Make plans for a better Friendica interface design and share them with us.
|
* Make plans for a better Friendica interface design and share them with us.
|
||||||
* Tell us if you are able to realize your ideas or what kind of help you need.
|
* Tell us if you are able to realize your ideas or what kind of help you need.
|
||||||
We can't promise we have the right skills in the group but we'll try.
|
We can't promise we have the right skills in the group but we'll try.
|
||||||
|
|
|
@ -40,6 +40,14 @@ Requirements
|
||||||
Installation procedure
|
Installation procedure
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Alternative Installation Methods
|
||||||
|
|
||||||
|
This guide will walk you through the manual installation process of Friendica.
|
||||||
|
If this is nothing for you, you might be interested in
|
||||||
|
|
||||||
|
* the [Friendica Docker image](https://github.com/friendica/docker) or
|
||||||
|
* how [install Friendica with YunoHost](https://github.com/YunoHost-Apps/friendica_ynh).
|
||||||
|
|
||||||
### Get Friendica
|
### Get Friendica
|
||||||
|
|
||||||
Unpack the Friendica files into the root of your web server document area.
|
Unpack the Friendica files into the root of your web server document area.
|
||||||
|
@ -164,6 +172,7 @@ if you don't use the option `--savedb` during installation, the DB credentials w
|
||||||
This variables wont be used at normal Friendica runtime.
|
This variables wont be used at normal Friendica runtime.
|
||||||
Instead, they get saved into `config/local.ini.php`.
|
Instead, they get saved into `config/local.ini.php`.
|
||||||
|
|
||||||
|
- `FRIENDICA_URL_PATH` The URL path of Friendica (f.e. '/friendica')
|
||||||
- `FRIENDICA_PHP_PATH` The path of the PHP binary
|
- `FRIENDICA_PHP_PATH` The path of the PHP binary
|
||||||
- `FRIENDICA_ADMIN_MAIL` The admin email address of Friendica (this email will be used for admin access)
|
- `FRIENDICA_ADMIN_MAIL` The admin email address of Friendica (this email will be used for admin access)
|
||||||
- `FRIENDICA_TZ` The timezone of Friendica
|
- `FRIENDICA_TZ` The timezone of Friendica
|
||||||
|
@ -182,7 +191,8 @@ All options will be saved in the `config/local.ini.php` and are overruling the a
|
||||||
- `-U|--dbuser <username>` The username of the mysql/mariadb database login (env `MYSQL_USER` or `MYSQL_USERNAME`)
|
- `-U|--dbuser <username>` The username of the mysql/mariadb database login (env `MYSQL_USER` or `MYSQL_USERNAME`)
|
||||||
- `-P|--dbpass <password>` The password of the mysql/mariadb database login (env `MYSQL_PASSWORD`)
|
- `-P|--dbpass <password>` The password of the mysql/mariadb database login (env `MYSQL_PASSWORD`)
|
||||||
- `-d|--dbdata <database>` The name of the mysql/mariadb database (env `MYSQL_DATABASE`)
|
- `-d|--dbdata <database>` The name of the mysql/mariadb database (env `MYSQL_DATABASE`)
|
||||||
- `-b|--phppath <path>` The path of the PHP binary (env `FRIENDICA_PHP_PATH`)
|
- `-u|--urlpath <url_path>` The URL path of Friendica - f.e. '/friendica' (env `FRIENDICA_URL_PATH`)
|
||||||
|
- `-b|--phppath <php_path>` The path of the PHP binary (env `FRIENDICA_PHP_PATH`)
|
||||||
- `-A|--admin <mail>` The admin email address of Friendica (env `FRIENDICA_ADMIN_MAIL`)
|
- `-A|--admin <mail>` The admin email address of Friendica (env `FRIENDICA_ADMIN_MAIL`)
|
||||||
- `-T|--tz <timezone>` The timezone of Friendica (env `FRIENDICA_TZ`)
|
- `-T|--tz <timezone>` The timezone of Friendica (env `FRIENDICA_TZ`)
|
||||||
- `-L|--land <language>` The language of Friendica (env `FRIENDICA_LANG`)
|
- `-L|--land <language>` The language of Friendica (env `FRIENDICA_LANG`)
|
||||||
|
|
|
@ -15,6 +15,6 @@ Remember the link at the top of this page will bring you back here.
|
||||||
|
|
||||||
Once you've added some groups, <a href="help/Quick-Start-andfinally">move on to the next section</a>.
|
Once you've added some groups, <a href="help/Quick-Start-andfinally">move on to the next section</a>.
|
||||||
|
|
||||||
<iframe src="http://dir.friendica.com/directory/forum" width="950" height="600"></iframe>
|
<iframe src="http://dir.friendica.social/directory" width="950" height="600"></iframe>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ Hier ist eine Liste von Clients bei denen dies möglich ist, bzw. die speziell f
|
||||||
<a name="help"></a>
|
<a name="help"></a>
|
||||||
### Wo finde ich Hilfe?
|
### Wo finde ich Hilfe?
|
||||||
|
|
||||||
Wenn Du Probleme mit Deiner Friendica-Seite hast, dann kannst Du die Community in der [Friendica-Support-Gruppe](https://forum.friendi.ca/profile/helpers) oder im [deutschen Friendica-Support-Forum](http://toktan.org/profile/wiki) fragen oder Dir das [deutsche Wiki](http://wiki.toktan.org/doku.php) anschauen.
|
Wenn Du Probleme mit Deiner Friendica-Seite hast, dann kannst Du die Community in der [Friendica-Support-Gruppe](https://forum.friendi.ca/profile/helpers) fragen oder Dir das [deutsche Wiki](https://friendica-wiki.de/) anschauen.
|
||||||
Wenn Du Deinen Account nicht nutzen kannst, kannst Du entweder einen [Testaccount](https://tryfriendica.de) bzw. einen Account auf einer öffentlichen Seite ([Liste](https://dir.friendica.social/servers)) nutzen.
|
Wenn Du Deinen Account nicht nutzen kannst, kannst Du entweder einen [Testaccount](https://tryfriendica.de) bzw. einen Account auf einer öffentlichen Seite ([Liste](https://dir.friendica.social/servers)) nutzen.
|
||||||
|
|
||||||
Wenn du dir keinen weiteren Friendica Account einrichten willst, kannst du auch gerne über einen der folgenden alternativen Kanäle Hilfe suchen:
|
Wenn du dir keinen weiteren Friendica Account einrichten willst, kannst du auch gerne über einen der folgenden alternativen Kanäle Hilfe suchen:
|
||||||
|
|
|
@ -61,7 +61,7 @@ Friendica - Dokumentation und Ressourcen
|
||||||
**Externe Ressourcen**
|
**Externe Ressourcen**
|
||||||
|
|
||||||
* [Haupt-Webseite](https://friendi.ca)
|
* [Haupt-Webseite](https://friendi.ca)
|
||||||
* [Deutsches Friendica-Wiki](http://wiki.toktan.org/doku.php)
|
* [Deutsches Friendica-Wiki](https://friendica-wiki.de)
|
||||||
* Support Kanäle
|
* Support Kanäle
|
||||||
* [Friendica Support Forum](https://forum.friendi.ca/~helpers)
|
* [Friendica Support Forum](https://forum.friendi.ca/~helpers)
|
||||||
* [Mailing Listen Archiv](http://mailman.friendi.ca/mailman/listinfo/support-friendi.ca) zum Abonnieren der Liste eine E-Mail an ``support-request(at)friendi.ca?subject=subscribe`` senden
|
* [Mailing Listen Archiv](http://mailman.friendi.ca/mailman/listinfo/support-friendi.ca) zum Abonnieren der Liste eine E-Mail an ``support-request(at)friendi.ca?subject=subscribe`` senden
|
||||||
|
|
|
@ -40,6 +40,14 @@ Requirements
|
||||||
Installation
|
Installation
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Alternative Wege um Friendica zu Installieren
|
||||||
|
|
||||||
|
Diese Anleitung wird dir Schritt-für-Schritt zeigen wie du Friendica auf deinem Server installieren kannst.
|
||||||
|
Falls du an automatischen Möglichkeiten interesse hast, wirf doch einen Blick auf
|
||||||
|
|
||||||
|
* das [Docker image für Friendica](https://github.com/friendica/docker) oder
|
||||||
|
* die [Installation von Friendica auf YunoHost](https://github.com/YunoHost-Apps/friendica_ynh).
|
||||||
|
|
||||||
### Friendica
|
### Friendica
|
||||||
|
|
||||||
Entpacke die Friendica-Daten in das Quellverzeichnis (root) des Dokumentenbereichs deines Webservers.
|
Entpacke die Friendica-Daten in das Quellverzeichnis (root) des Dokumentenbereichs deines Webservers.
|
||||||
|
@ -82,7 +90,7 @@ Dies tust du mit den folgenden Befehlen
|
||||||
Die Entwickler Version kann nach einem fehlerhaften Commit vorübergehend Probleme haben oder gar nicht mehr funktionieren.
|
Die Entwickler Version kann nach einem fehlerhaften Commit vorübergehend Probleme haben oder gar nicht mehr funktionieren.
|
||||||
Sollte dir so etwas passieren, lass es uns bitte wissen, damit der Fehler behoben werden kann.
|
Sollte dir so etwas passieren, lass es uns bitte wissen, damit der Fehler behoben werden kann.
|
||||||
|
|
||||||
### Erselle eine Datenbank
|
### Erstelle eine Datenbank
|
||||||
|
|
||||||
Erstelle eine leere Datenbank und notiere alle Zugangsdaten (Adresse der Datenbank, Nutzername, Passwort, Datenbankname).
|
Erstelle eine leere Datenbank und notiere alle Zugangsdaten (Adresse der Datenbank, Nutzername, Passwort, Datenbankname).
|
||||||
|
|
||||||
|
|
212
include/api.php
212
include/api.php
|
@ -581,7 +581,10 @@ function api_get_user(App $a, $contact_id = null)
|
||||||
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (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);
|
||||||
if (!empty($a->argv[$argid])) {
|
if (!empty($a->argv[$argid])) {
|
||||||
list($user, $null) = explode(".", $a->argv[$argid]);
|
$data = explode(".", $a->argv[$argid]);
|
||||||
|
if (count($data) > 1) {
|
||||||
|
list($user, $null) = $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (is_numeric($user)) {
|
if (is_numeric($user)) {
|
||||||
$user = DBA::escape(api_unique_id_to_nurl(intval($user)));
|
$user = DBA::escape(api_unique_id_to_nurl(intval($user)));
|
||||||
|
@ -758,7 +761,7 @@ function api_get_user(App $a, $contact_id = null)
|
||||||
'statusnet_blocking' => false,
|
'statusnet_blocking' => false,
|
||||||
'notifications' => false,
|
'notifications' => false,
|
||||||
/// @TODO old way?
|
/// @TODO old way?
|
||||||
//'statusnet_profile_url' => System::baseUrl()."/contacts/".$uinfo[0]['cid'],
|
//'statusnet_profile_url' => System::baseUrl()."/contact/".$uinfo[0]['cid'],
|
||||||
'statusnet_profile_url' => $uinfo[0]['url'],
|
'statusnet_profile_url' => $uinfo[0]['url'],
|
||||||
'uid' => intval($uinfo[0]['uid']),
|
'uid' => intval($uinfo[0]['uid']),
|
||||||
'cid' => intval($uinfo[0]['cid']),
|
'cid' => intval($uinfo[0]['cid']),
|
||||||
|
@ -816,7 +819,7 @@ function api_item_get_user(App $a, $item)
|
||||||
$status_user["protected"] = defaults($item, 'private', 0);
|
$status_user["protected"] = defaults($item, 'private', 0);
|
||||||
|
|
||||||
if (defaults($item, 'thr-parent', '') == defaults($item, 'uri', '')) {
|
if (defaults($item, 'thr-parent', '') == defaults($item, 'uri', '')) {
|
||||||
$owner_user = api_get_user($a, defaults($item, 'author-id', null));
|
$owner_user = api_get_user($a, defaults($item, 'owner-id', null));
|
||||||
} else {
|
} else {
|
||||||
$owner_user = $status_user;
|
$owner_user = $status_user;
|
||||||
}
|
}
|
||||||
|
@ -1056,10 +1059,10 @@ function api_statuses_mediap($type)
|
||||||
|
|
||||||
// now that we have the img url in bbcode we can add it to the status and insert the wall item.
|
// now that we have the img url in bbcode we can add it to the status and insert the wall item.
|
||||||
$_REQUEST['body'] = $txt . "\n\n" . '[url=' . $picture["albumpage"] . '][img]' . $picture["preview"] . "[/img][/url]";
|
$_REQUEST['body'] = $txt . "\n\n" . '[url=' . $picture["albumpage"] . '][img]' . $picture["preview"] . "[/img][/url]";
|
||||||
item_post($a);
|
$item_id = item_post($a);
|
||||||
|
|
||||||
// this should output the last post (the one we just posted).
|
// output the post that we just posted.
|
||||||
return api_status_show($type);
|
return api_status_show($type, $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO move this to top of file or somewhere better!
|
/// @TODO move this to top of file or somewhere better!
|
||||||
|
@ -1075,7 +1078,6 @@ api_register_func('api/statuses/mediap', 'api_statuses_mediap', true, API_METHOD
|
||||||
*/
|
*/
|
||||||
function api_statuses_update($type)
|
function api_statuses_update($type)
|
||||||
{
|
{
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if (api_user() === false) {
|
if (api_user() === false) {
|
||||||
|
@ -1129,8 +1131,8 @@ function api_statuses_update($type)
|
||||||
if ($throttle_day > 0) {
|
if ($throttle_day > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
||||||
$posts_day = DBA::count('item', $condition);
|
$posts_day = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_day > $throttle_day) {
|
if ($posts_day > $throttle_day) {
|
||||||
logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
logger('Daily posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||||
|
@ -1143,8 +1145,8 @@ function api_statuses_update($type)
|
||||||
if ($throttle_week > 0) {
|
if ($throttle_week > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*7);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
||||||
$posts_week = DBA::count('item', $condition);
|
$posts_week = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_week > $throttle_week) {
|
if ($posts_week > $throttle_week) {
|
||||||
logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
logger('Weekly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||||
|
@ -1157,8 +1159,8 @@ function api_statuses_update($type)
|
||||||
if ($throttle_month > 0) {
|
if ($throttle_month > 0) {
|
||||||
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
$datefrom = date(DateTimeFormat::MYSQL, time() - 24*60*60*30);
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `wall` AND `created` > ? AND `id` = `parent`", api_user(), $datefrom];
|
$condition = ["`uid` = ? AND `wall` AND `created` > ?", api_user(), $datefrom];
|
||||||
$posts_month = DBA::count('item', $condition);
|
$posts_month = DBA::count('thread', $condition);
|
||||||
|
|
||||||
if ($posts_month > $throttle_month) {
|
if ($posts_month > $throttle_month) {
|
||||||
logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
logger('Monthly posting limit reached for user '.api_user(), LOGGER_DEBUG);
|
||||||
|
@ -1200,10 +1202,10 @@ function api_statuses_update($type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// call out normal post function
|
// call out normal post function
|
||||||
item_post($a);
|
$item_id = item_post($a);
|
||||||
|
|
||||||
// this should output the last post (the one we just posted).
|
// output the post that we just posted.
|
||||||
return api_status_show($type);
|
return api_status_show($type, $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO move to top of file or somewhere better
|
/// @TODO move to top of file or somewhere better
|
||||||
|
@ -1260,7 +1262,7 @@ api_register_func('api/media/upload', 'api_media_upload', true, API_METHOD_POST)
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
*/
|
*/
|
||||||
function api_status_show($type)
|
function api_status_show($type, $item_id = 0)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -1274,9 +1276,14 @@ function api_status_show($type)
|
||||||
$privacy_sql = "";
|
$privacy_sql = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// get last public wall message
|
if (!empty($item_id)) {
|
||||||
$condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
|
// Get the item with the given id
|
||||||
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
$condition = ['id' => $item_id];
|
||||||
|
} else {
|
||||||
|
// get last public wall message
|
||||||
|
$condition = ['owner-id' => $user_info['pid'], 'uid' => api_user(),
|
||||||
|
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT]];
|
||||||
|
}
|
||||||
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
|
$lastwall = Item::selectFirst(Item::ITEM_FIELDLIST, $condition, ['order' => ['id' => true]]);
|
||||||
|
|
||||||
if (DBA::isResult($lastwall)) {
|
if (DBA::isResult($lastwall)) {
|
||||||
|
@ -1993,14 +2000,14 @@ function api_statuses_repeat($type)
|
||||||
$_REQUEST["source"] = api_source();
|
$_REQUEST["source"] = api_source();
|
||||||
}
|
}
|
||||||
|
|
||||||
item_post($a);
|
$item_id = item_post($a);
|
||||||
} else {
|
} else {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this should output the last post (the one we just posted).
|
// output the post that we just posted.
|
||||||
$called_api = [];
|
$called_api = [];
|
||||||
return api_status_show($type);
|
return api_status_show($type, $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO move to top of file or somewhere better
|
/// @TODO move to top of file or somewhere better
|
||||||
|
@ -2344,7 +2351,7 @@ function api_format_messages($item, $recipient, $sender)
|
||||||
// standard meta information
|
// standard meta information
|
||||||
$ret = [
|
$ret = [
|
||||||
'id' => $item['id'],
|
'id' => $item['id'],
|
||||||
'sender_id' => $sender['id'] ,
|
'sender_id' => $sender['id'],
|
||||||
'text' => "",
|
'text' => "",
|
||||||
'recipient_id' => $recipient['id'],
|
'recipient_id' => $recipient['id'],
|
||||||
'created_at' => api_date(defaults($item, 'created', DateTimeFormat::utcNow())),
|
'created_at' => api_date(defaults($item, 'created', DateTimeFormat::utcNow())),
|
||||||
|
@ -2725,7 +2732,7 @@ function api_contactlink_to_array($txt)
|
||||||
* likes => int count,
|
* likes => int count,
|
||||||
* dislikes => int count
|
* dislikes => int count
|
||||||
*/
|
*/
|
||||||
function api_format_items_activities(&$item, $type = "json")
|
function api_format_items_activities($item, $type = "json")
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -2740,13 +2747,13 @@ function api_format_items_activities(&$item, $type = "json")
|
||||||
$condition = ['uid' => $item['uid'], 'thr-parent' => $item['uri']];
|
$condition = ['uid' => $item['uid'], 'thr-parent' => $item['uri']];
|
||||||
$ret = Item::selectForUser($item['uid'], ['author-id', 'verb'], $condition);
|
$ret = Item::selectForUser($item['uid'], ['author-id', 'verb'], $condition);
|
||||||
|
|
||||||
while ($item = Item::fetch($ret)) {
|
while ($parent_item = Item::fetch($ret)) {
|
||||||
// not used as result should be structured like other user data
|
// not used as result should be structured like other user data
|
||||||
//builtin_activity_puller($i, $activities);
|
//builtin_activity_puller($i, $activities);
|
||||||
|
|
||||||
// get user data and add it to the array of the activity
|
// get user data and add it to the array of the activity
|
||||||
$user = api_get_user($a, $item['author-id']);
|
$user = api_get_user($a, $parent_item['author-id']);
|
||||||
switch ($item['verb']) {
|
switch ($parent_item['verb']) {
|
||||||
case ACTIVITY_LIKE:
|
case ACTIVITY_LIKE:
|
||||||
$activities['like'][] = $user;
|
$activities['like'][] = $user;
|
||||||
break;
|
break;
|
||||||
|
@ -2886,7 +2893,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json")
|
||||||
'in_reply_to_screen_name' => $in_reply_to['screen_name'],
|
'in_reply_to_screen_name' => $in_reply_to['screen_name'],
|
||||||
$geo => null,
|
$geo => null,
|
||||||
'favorited' => $item['starred'] ? true : false,
|
'favorited' => $item['starred'] ? true : false,
|
||||||
'user' => $status_user ,
|
'user' => $status_user,
|
||||||
'friendica_owner' => $owner_user,
|
'friendica_owner' => $owner_user,
|
||||||
'friendica_private' => $item['private'] == 1,
|
'friendica_private' => $item['private'] == 1,
|
||||||
//'entities' => NULL,
|
//'entities' => NULL,
|
||||||
|
@ -3337,7 +3344,7 @@ function api_statusnet_config($type)
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
$name = Config::get('config', 'sitename');
|
$name = Config::get('config', 'sitename');
|
||||||
$server = $a->get_hostname();
|
$server = $a->getHostName();
|
||||||
$logo = System::baseUrl() . '/images/friendica-64.png';
|
$logo = System::baseUrl() . '/images/friendica-64.png';
|
||||||
$email = Config::get('config', 'admin_email');
|
$email = Config::get('config', 'admin_email');
|
||||||
$closed = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';
|
$closed = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';
|
||||||
|
@ -3394,7 +3401,7 @@ api_register_func('api/statusnet/version', 'api_statusnet_version', false);
|
||||||
*/
|
*/
|
||||||
function api_ff_ids($type)
|
function api_ff_ids($type)
|
||||||
{
|
{
|
||||||
if (! api_user()) {
|
if (!api_user()) {
|
||||||
throw new ForbiddenException();
|
throw new ForbiddenException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3622,6 +3629,84 @@ function api_direct_messages_destroy($type)
|
||||||
/// @TODO move to top of file or somewhere better
|
/// @TODO move to top of file or somewhere better
|
||||||
api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy', true, API_METHOD_DELETE);
|
api_register_func('api/direct_messages/destroy', 'api_direct_messages_destroy', true, API_METHOD_DELETE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfollow Contact
|
||||||
|
*
|
||||||
|
* @brief unfollow contact
|
||||||
|
*
|
||||||
|
* @param string $type Known types are 'atom', 'rss', 'xml' and 'json'
|
||||||
|
* @return string|array
|
||||||
|
* @see https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/post-friendships-destroy.html
|
||||||
|
*/
|
||||||
|
function api_friendships_destroy($type)
|
||||||
|
{
|
||||||
|
$uid = api_user();
|
||||||
|
|
||||||
|
if ($uid === false) {
|
||||||
|
throw new ForbiddenException();
|
||||||
|
}
|
||||||
|
|
||||||
|
$contact_id = defaults($_REQUEST, 'user_id');
|
||||||
|
|
||||||
|
if (empty($contact_id)) {
|
||||||
|
logger("No user_id specified", LOGGER_DEBUG);
|
||||||
|
throw new BadRequestException("no user_id specified");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Contact by given id
|
||||||
|
$contact = DBA::selectFirst('contact', ['url'], ['id' => $contact_id, 'uid' => 0, 'self' => false]);
|
||||||
|
|
||||||
|
if(!DBA::isResult($contact)) {
|
||||||
|
logger("No contact found for ID" . $contact_id, LOGGER_DEBUG);
|
||||||
|
throw new NotFoundException("no contact found to given ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = $contact["url"];
|
||||||
|
|
||||||
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||||
|
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
|
normalise_link($url), $url];
|
||||||
|
$contact = DBA::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
|
if (!DBA::isResult($contact)) {
|
||||||
|
logger("Not following Contact", LOGGER_DEBUG);
|
||||||
|
throw new NotFoundException("Not following Contact");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||||
|
logger("Not supported", LOGGER_DEBUG);
|
||||||
|
throw new ExpectationFailedException("Not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
$dissolve = ($contact['rel'] == Contact::SHARING);
|
||||||
|
|
||||||
|
$owner = User::getOwnerDataById($uid);
|
||||||
|
if ($owner) {
|
||||||
|
Contact::terminateFriendship($owner, $contact, $dissolve);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logger("No owner found", LOGGER_DEBUG);
|
||||||
|
throw new NotFoundException("Error Processing Request");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sharing-only contacts get deleted as there no relationship any more
|
||||||
|
if ($dissolve) {
|
||||||
|
Contact::remove($contact['id']);
|
||||||
|
} else {
|
||||||
|
DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "uid" and "self" are only needed for some internal stuff, so remove it from here
|
||||||
|
unset($contact["uid"]);
|
||||||
|
unset($contact["self"]);
|
||||||
|
|
||||||
|
// Set screen_name since Twidere requests it
|
||||||
|
$contact["screen_name"] = $contact["nick"];
|
||||||
|
|
||||||
|
return api_format_data("friendships-destroy", $type, ['user' => $contact]);
|
||||||
|
}
|
||||||
|
api_register_func('api/friendships/destroy', 'api_friendships_destroy', true, API_METHOD_POST);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param string $type Return type (atom, rss, xml, json)
|
* @param string $type Return type (atom, rss, xml, json)
|
||||||
|
@ -4396,7 +4481,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
if ($filetype == "") {
|
if ($filetype == "") {
|
||||||
$filetype=Image::guessType($filename);
|
$filetype=Image::guessType($filename);
|
||||||
}
|
}
|
||||||
$imagedata = getimagesize($src);
|
$imagedata = @getimagesize($src);
|
||||||
if ($imagedata) {
|
if ($imagedata) {
|
||||||
$filetype = $imagedata['mime'];
|
$filetype = $imagedata['mime'];
|
||||||
}
|
}
|
||||||
|
@ -4420,7 +4505,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
// create Photo instance with the data of the image
|
// create Photo instance with the data of the image
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$Image = new Image($imagedata, $filetype);
|
$Image = new Image($imagedata, $filetype);
|
||||||
if (! $Image->isValid()) {
|
if (!$Image->isValid()) {
|
||||||
throw new InternalServerErrorException("unable to process image data");
|
throw new InternalServerErrorException("unable to process image data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4430,7 +4515,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
|
|
||||||
// check max length of images on server
|
// check max length of images on server
|
||||||
$max_length = Config::get('system', 'max_image_length');
|
$max_length = Config::get('system', 'max_image_length');
|
||||||
if (! $max_length) {
|
if (!$max_length) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
|
@ -4448,13 +4533,13 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
|
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
|
||||||
|
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: image upload with scale 0 (original size) failed");
|
logger("photo upload: image upload with scale 0 (original size) failed");
|
||||||
}
|
}
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$Image->scaleDown(640);
|
$Image->scaleDown(640);
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: image upload with scale 1 (640x640) failed");
|
logger("photo upload: image upload with scale 1 (640x640) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4462,7 +4547,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$Image->scaleDown(320);
|
$Image->scaleDown(320);
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: image upload with scale 2 (320x320) failed");
|
logger("photo upload: image upload with scale 2 (320x320) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4474,7 +4559,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
if ($width > 175 || $height > 175) {
|
if ($width > 175 || $height > 175) {
|
||||||
$Image->scaleDown(175);
|
$Image->scaleDown(175);
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: profile image upload with scale 4 (175x175) failed");
|
logger("photo upload: profile image upload with scale 4 (175x175) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4482,7 +4567,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
if ($width > 80 || $height > 80) {
|
if ($width > 80 || $height > 80) {
|
||||||
$Image->scaleDown(80);
|
$Image->scaleDown(80);
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: profile image upload with scale 5 (80x80) failed");
|
logger("photo upload: profile image upload with scale 5 (80x80) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4490,7 +4575,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
if ($width > 48 || $height > 48) {
|
if ($width > 48 || $height > 48) {
|
||||||
$Image->scaleDown(48);
|
$Image->scaleDown(48);
|
||||||
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (!$r) {
|
||||||
logger("photo upload: profile image upload with scale 6 (48x48) failed");
|
logger("photo upload: profile image upload with scale 6 (48x48) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4527,7 +4612,7 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
|
||||||
$owner_record = DBA::selectFirst('contact', [], ['uid' => api_user(), 'self' => true]);
|
$owner_record = DBA::selectFirst('contact', [], ['uid' => api_user(), 'self' => true]);
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uid'] = intval(api_user());
|
$arr['uid'] = intval(api_user());
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['parent-uri'] = $uri;
|
$arr['parent-uri'] = $uri;
|
||||||
|
@ -4742,77 +4827,86 @@ function api_share_as_retweet(&$item)
|
||||||
{
|
{
|
||||||
$body = trim($item["body"]);
|
$body = trim($item["body"]);
|
||||||
|
|
||||||
if (Diaspora::isReshare($body, false)===false) {
|
if (Diaspora::isReshare($body, false) === false) {
|
||||||
return false;
|
if ($item['author-id'] == $item['owner-id']) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// Reshares from OStatus, ActivityPub and Twitter
|
||||||
|
$reshared_item = $item;
|
||||||
|
$reshared_item['owner-id'] = $reshared_item['author-id'];
|
||||||
|
$reshared_item['owner-link'] = $reshared_item['author-link'];
|
||||||
|
$reshared_item['owner-name'] = $reshared_item['author-name'];
|
||||||
|
$reshared_item['owner-avatar'] = $reshared_item['author-avatar'];
|
||||||
|
return $reshared_item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO "$1" should maybe mean '$1' ?
|
/// @TODO "$1" should maybe mean '$1' ?
|
||||||
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "$1", $body);
|
$attributes = preg_replace("/\[share(.*?)\]\s?(.*?)\s?\[\/share\]\s?/ism", "$1", $body);
|
||||||
/*
|
/*
|
||||||
* Skip if there is no shared message in there
|
* Skip if there is no shared message in there
|
||||||
* we already checked this in diaspora::isReshare()
|
* we already checked this in diaspora::isReshare()
|
||||||
* but better one more than one less...
|
* but better one more than one less...
|
||||||
*/
|
*/
|
||||||
if ($body == $attributes) {
|
if (($body == $attributes) || empty($attributes)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// build the fake reshared item
|
// build the fake reshared item
|
||||||
$reshared_item = $item;
|
$reshared_item = $item;
|
||||||
|
|
||||||
$author = "";
|
$author = "";
|
||||||
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
preg_match("/author='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
|
$author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
preg_match('/author="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$author = $matches[1];
|
$author = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = "";
|
$profile = "";
|
||||||
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$profile = $matches[1];
|
$profile = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$profile = $matches[1];
|
$profile = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$avatar = "";
|
$avatar = "";
|
||||||
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$avatar = $matches[1];
|
$avatar = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
|
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$avatar = $matches[1];
|
$avatar = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = "";
|
$link = "";
|
||||||
preg_match("/link='(.*?)'/ism", $attributes, $matches);
|
preg_match("/link='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$link = $matches[1];
|
$link = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/link="(.*?)"/ism', $attributes, $matches);
|
preg_match('/link="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$link = $matches[1];
|
$link = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$posted = "";
|
$posted = "";
|
||||||
preg_match("/posted='(.*?)'/ism", $attributes, $matches);
|
preg_match("/posted='(.*?)'/ism", $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$posted = $matches[1];
|
$posted = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
preg_match('/posted="(.*?)"/ism', $attributes, $matches);
|
preg_match('/posted="(.*?)"/ism', $attributes, $matches);
|
||||||
if ($matches[1] != "") {
|
if (!empty($matches[1])) {
|
||||||
$posted = $matches[1];
|
$posted = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -229,12 +229,12 @@ function localize_item(&$item)
|
||||||
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
|
$xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
|
||||||
|
|
||||||
$obj = XML::parseString($xmlhead.$item['object']);
|
$obj = XML::parseString($xmlhead.$item['object']);
|
||||||
$links = XML::parseString($xmlhead."<links>".unxmlify($obj->link)."</links>");
|
|
||||||
|
|
||||||
$Bname = $obj->title;
|
$Bname = $obj->title;
|
||||||
$Blink = "";
|
$Blink = $obj->id;
|
||||||
$Bphoto = "";
|
$Bphoto = "";
|
||||||
foreach ($links->link as $l) {
|
|
||||||
|
foreach ($obj->link as $l) {
|
||||||
$atts = $l->attributes();
|
$atts = $l->attributes();
|
||||||
switch ($atts['rel']) {
|
switch ($atts['rel']) {
|
||||||
case "alternate": $Blink = $atts['href'];
|
case "alternate": $Blink = $atts['href'];
|
||||||
|
@ -556,7 +556,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
|
||||||
if (in_array($mode, ['community', 'contacts'])) {
|
if (in_array($mode, ['community', 'contacts'])) {
|
||||||
$writable = true;
|
$writable = true;
|
||||||
} else {
|
} else {
|
||||||
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
|
@ -657,7 +657,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
|
||||||
'id' => ($preview ? 'P0' : $item['id']),
|
'id' => ($preview ? 'P0' : $item['id']),
|
||||||
'guid' => ($preview ? 'Q0' : $item['guid']),
|
'guid' => ($preview ? 'Q0' : $item['guid']),
|
||||||
'network' => $item['network'],
|
'network' => $item['network'],
|
||||||
'network_name' => ContactSelector::networkToName($item['network'], $profile_link),
|
'network_name' => ContactSelector::networkToName($item['network'], $item['author-link']),
|
||||||
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
|
'linktitle' => L10n::t('View %s\'s profile @ %s', $profile_name, $item['author-link']),
|
||||||
'profile_url' => $profile_link,
|
'profile_url' => $profile_link,
|
||||||
'item_photo_menu' => item_photo_menu($item),
|
'item_photo_menu' => item_photo_menu($item),
|
||||||
|
@ -807,7 +807,7 @@ function conversation_add_children(array $parents, $block_authors, $order, $uid)
|
||||||
|
|
||||||
foreach ($items as $index => $item) {
|
foreach ($items as $index => $item) {
|
||||||
if ($item['uid'] == 0) {
|
if ($item['uid'] == 0) {
|
||||||
$items[$index]['writable'] = in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
$items[$index]['writable'] = in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -853,8 +853,8 @@ function item_photo_menu($item) {
|
||||||
|
|
||||||
if ($cid && !$item['self']) {
|
if ($cid && !$item['self']) {
|
||||||
$poke_link = 'poke/?f=&c=' . $cid;
|
$poke_link = 'poke/?f=&c=' . $cid;
|
||||||
$contact_url = 'contacts/' . $cid;
|
$contact_url = 'contact/' . $cid;
|
||||||
$posts_link = 'contacts/' . $cid . '/posts';
|
$posts_link = 'contact/' . $cid . '/posts';
|
||||||
|
|
||||||
if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
|
if (in_array($network, [Protocol::DFRN, Protocol::DIASPORA])) {
|
||||||
$pm_url = 'message/new/' . $cid;
|
$pm_url = 'message/new/' . $cid;
|
||||||
|
@ -877,7 +877,7 @@ function item_photo_menu($item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
|
if ((($cid == 0) || ($rel == Contact::FOLLOWER)) &&
|
||||||
in_array($item['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
|
in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
|
||||||
$menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
|
$menu[L10n::t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1091,21 +1091,6 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
|
||||||
'$delitems' => L10n::t("Delete item\x28s\x29?")
|
'$delitems' => L10n::t("Delete item\x28s\x29?")
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('jot-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$newpost' => 'true',
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
'$geotag' => $geotag,
|
|
||||||
'$nickname' => $x['nickname'],
|
|
||||||
'$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
|
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:'),
|
|
||||||
'$vidurl' => L10n::t("Please enter a video link/URL:"),
|
|
||||||
'$audurl' => L10n::t("Please enter an audio link/URL:"),
|
|
||||||
'$term' => L10n::t('Tag term:'),
|
|
||||||
'$fileas' => L10n::t('Save to Folder:'),
|
|
||||||
'$whereareu' => L10n::t('Where are you right now?')
|
|
||||||
]);
|
|
||||||
|
|
||||||
$jotplugins = '';
|
$jotplugins = '';
|
||||||
Addon::callHooks('jot_tool', $jotplugins);
|
Addon::callHooks('jot_tool', $jotplugins);
|
||||||
|
|
||||||
|
@ -1454,7 +1439,7 @@ function get_responses(array $conv_responses, array $response_verbs, $ob, array
|
||||||
$ret = [];
|
$ret = [];
|
||||||
foreach ($response_verbs as $v) {
|
foreach ($response_verbs as $v) {
|
||||||
$ret[$v] = [];
|
$ret[$v] = [];
|
||||||
$ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], '');
|
$ret[$v]['count'] = defaults($conv_responses[$v], $item['uri'], 0);
|
||||||
$ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', []);
|
$ret[$v]['list'] = defaults($conv_responses[$v], $item['uri'] . '-l', []);
|
||||||
$ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0');
|
$ret[$v]['self'] = defaults($conv_responses[$v], $item['uri'] . '-self', '0');
|
||||||
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
if (count($ret[$v]['list']) > MAX_LIKERS) {
|
||||||
|
|
|
@ -42,9 +42,9 @@ function notification($params)
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
|
$params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
|
||||||
$params['language'] = defaults($params, 'language', $user['language']);
|
$params['language'] = defaults($params, 'language' , $user['language']);
|
||||||
$params['to_name'] = defaults($params, 'to_name', $user['username']);
|
$params['to_name'] = defaults($params, 'to_name' , $user['username']);
|
||||||
$params['to_email'] = defaults($params, 'to_email', $user['email']);
|
$params['to_email'] = defaults($params, 'to_email' , $user['email']);
|
||||||
|
|
||||||
// from here on everything is in the recipients language
|
// from here on everything is in the recipients language
|
||||||
L10n::pushLang($params['language']);
|
L10n::pushLang($params['language']);
|
||||||
|
@ -61,7 +61,7 @@ function notification($params)
|
||||||
}
|
}
|
||||||
|
|
||||||
$sender_name = $sitename;
|
$sender_name = $sitename;
|
||||||
$hostname = $a->get_hostname();
|
$hostname = $a->getHostName();
|
||||||
if (strpos($hostname, ':')) {
|
if (strpos($hostname, ':')) {
|
||||||
$hostname = substr($hostname, 0, strpos($hostname, ':'));
|
$hostname = substr($hostname, 0, strpos($hostname, ':'));
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ function notification($params)
|
||||||
// with $params['show_in_notification_page'] == false, the notification isn't inserted into
|
// with $params['show_in_notification_page'] == false, the notification isn't inserted into
|
||||||
// the database, and an email is sent if applicable.
|
// the database, and an email is sent if applicable.
|
||||||
// default, if not specified: true
|
// default, if not specified: true
|
||||||
$show_in_notification_page = ((x($params, 'show_in_notification_page')) ? $params['show_in_notification_page']:true);
|
$show_in_notification_page = isset($params['show_in_notification_page']) ? $params['show_in_notification_page'] : true;
|
||||||
|
|
||||||
$additional_mail_header = "";
|
$additional_mail_header = "";
|
||||||
$additional_mail_header .= "Precedence: list\n";
|
$additional_mail_header .= "Precedence: list\n";
|
||||||
|
|
|
@ -72,7 +72,8 @@ function add_page_info_data(array $data, $no_photos = false)
|
||||||
$text .= " title='".$data["title"]."'";
|
$text .= " title='".$data["title"]."'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($data["images"])) {
|
// Only embedd a picture link when it seems to be a valid picture ("width" is set)
|
||||||
|
if (!empty($data["images"]) && !empty($data["images"][0]["width"])) {
|
||||||
$preview = str_replace(["[", "]"], ["[", "]"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false));
|
$preview = str_replace(["[", "]"], ["[", "]"], 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)
|
||||||
|
@ -315,9 +316,9 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
|
||||||
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
|
DBA::update('contact', ['hub-verify' => $verify_token], ['id' => $contact['id']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Network::post($url, $params);
|
$postResult = Network::post($url, $params);
|
||||||
|
|
||||||
logger('subscribe_to_hub: returns: ' . $a->get_curl_code(), LOGGER_DEBUG);
|
logger('subscribe_to_hub: returns: ' . $postResult->getReturnCode(), LOGGER_DEBUG);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -348,12 +349,12 @@ function drop_item($id)
|
||||||
|
|
||||||
// locate item to be deleted
|
// locate item to be deleted
|
||||||
|
|
||||||
$fields = ['id', 'uid', 'contact-id', 'deleted'];
|
$fields = ['id', 'uid', 'guid', 'contact-id', 'deleted'];
|
||||||
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);
|
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);
|
||||||
|
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
notice(L10n::t('Item not found.') . EOL);
|
notice(L10n::t('Item not found.') . EOL);
|
||||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
goaway('/network');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($item['deleted']) {
|
if ($item['deleted']) {
|
||||||
|
@ -400,17 +401,17 @@ function drop_item($id)
|
||||||
}
|
}
|
||||||
// Now check how the user responded to the confirmation query
|
// Now check how the user responded to the confirmation query
|
||||||
if (!empty($_REQUEST['canceled'])) {
|
if (!empty($_REQUEST['canceled'])) {
|
||||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
goaway('/display/' . $item['guid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the item
|
// delete the item
|
||||||
Item::deleteForUser(['id' => $item['id']], local_user());
|
Item::deleteForUser(['id' => $item['id']], local_user());
|
||||||
|
|
||||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
goaway('/network');
|
||||||
//NOTREACHED
|
//NOTREACHED
|
||||||
} else {
|
} else {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
goaway('/display/' . $item['guid']);
|
||||||
//NOTREACHED
|
//NOTREACHED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ function replace_macros($s, $r) {
|
||||||
// pass $baseurl to all templates
|
// pass $baseurl to all templates
|
||||||
$r['$baseurl'] = System::baseUrl();
|
$r['$baseurl'] = System::baseUrl();
|
||||||
|
|
||||||
$t = $a->template_engine();
|
$t = $a->getTemplateEngine();
|
||||||
try {
|
try {
|
||||||
$output = $t->replaceMacros($s, $r);
|
$output = $t->replaceMacros($s, $r);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -50,7 +50,7 @@ function replace_macros($s, $r) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->save_timestamp($stamp1, "rendering");
|
$a->saveTimestamp($stamp1, "rendering");
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
@ -473,7 +473,7 @@ function get_markup_template($s, $root = '') {
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$t = $a->template_engine();
|
$t = $a->getTemplateEngine();
|
||||||
try {
|
try {
|
||||||
$template = $t->getTemplateFile($s, $root);
|
$template = $t->getTemplateFile($s, $root);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -481,7 +481,7 @@ function get_markup_template($s, $root = '') {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->saveTimestamp($stamp1, "file");
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ function logger($msg, $level = LOGGER_INFO) {
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
@file_put_contents($logfile, $logline, FILE_APPEND);
|
@file_put_contents($logfile, $logline, FILE_APPEND);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->saveTimestamp($stamp1, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -634,7 +634,7 @@ function dlogger($msg, $level = LOGGER_INFO) {
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
@file_put_contents($logfile, $logline, FILE_APPEND);
|
@file_put_contents($logfile, $logline, FILE_APPEND);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->saveTimestamp($stamp1, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1191,9 +1191,6 @@ function prepare_body(array &$item, $attach = false, $is_preview = false)
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
|
$a->page['htmlhead'] .= replace_macros(get_markup_template('videos_head.tpl'), [
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => System::baseUrl(),
|
||||||
]);
|
]);
|
||||||
$a->page['end'] .= replace_macros(get_markup_template('videos_end.tpl'), [
|
|
||||||
'$baseurl' => System::baseUrl(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$url_parts = explode('/', $the_url);
|
$url_parts = explode('/', $the_url);
|
||||||
|
@ -1417,7 +1414,7 @@ function get_plink($item) {
|
||||||
];
|
];
|
||||||
|
|
||||||
if (x($item, 'plink')) {
|
if (x($item, 'plink')) {
|
||||||
$ret["href"] = $a->remove_baseurl($item['plink']);
|
$ret["href"] = $a->removeBaseURL($item['plink']);
|
||||||
$ret["title"] = L10n::t('link to source');
|
$ret["title"] = L10n::t('link to source');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1911,58 +1908,3 @@ function format_network_name($network, $url = 0) {
|
||||||
return $network_name;
|
return $network_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Syntax based code highlighting for popular languages.
|
|
||||||
* @param string $s Code block
|
|
||||||
* @param string $lang Programming language
|
|
||||||
* @return string Formated html
|
|
||||||
*/
|
|
||||||
function text_highlight($s, $lang) {
|
|
||||||
if ($lang === 'js') {
|
|
||||||
$lang = 'javascript';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($lang === 'bash') {
|
|
||||||
$lang = 'sh';
|
|
||||||
}
|
|
||||||
|
|
||||||
// @TODO: Replace Text_Highlighter_Renderer_Html by scrivo/highlight.php
|
|
||||||
|
|
||||||
// Autoload the library to make constants available
|
|
||||||
class_exists('Text_Highlighter_Renderer_Html');
|
|
||||||
|
|
||||||
$options = [
|
|
||||||
'numbers' => HL_NUMBERS_LI,
|
|
||||||
'tabsize' => 4,
|
|
||||||
];
|
|
||||||
|
|
||||||
$tag_added = false;
|
|
||||||
$s = trim(html_entity_decode($s, ENT_COMPAT));
|
|
||||||
$s = str_replace(' ', "\t", $s);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The highlighter library insists on an opening php tag for php code blocks. If
|
|
||||||
* it isn't present, nothing is highlighted. So we're going to see if it's present.
|
|
||||||
* If not, we'll add it, and then quietly remove it after we get the processed output back.
|
|
||||||
*/
|
|
||||||
if ($lang === 'php' && strpos($s, '<?php') !== 0) {
|
|
||||||
$s = '<?php' . "\n" . $s;
|
|
||||||
$tag_added = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$renderer = new Text_Highlighter_Renderer_Html($options);
|
|
||||||
$factory = new Text_Highlighter();
|
|
||||||
$hl = $factory->factory($lang);
|
|
||||||
$hl->setRenderer($renderer);
|
|
||||||
$o = $hl->highlight($s);
|
|
||||||
$o = str_replace("\n", '', $o);
|
|
||||||
|
|
||||||
if ($tag_added) {
|
|
||||||
$b = substr($o, 0, strpos($o, '<li>'));
|
|
||||||
$e = substr($o, strpos($o, '</li>'));
|
|
||||||
$o = $b . $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<code>' . $o . '</code>';
|
|
||||||
}
|
|
||||||
|
|
114
index.php
114
index.php
|
@ -23,11 +23,9 @@ use Friendica\Module\Login;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
|
||||||
$a = new App(__DIR__);
|
|
||||||
|
|
||||||
// We assume that the index.php is called by a frontend process
|
// We assume that the index.php is called by a frontend process
|
||||||
// The value is set to "true" by default in boot.php
|
// The value is set to "true" by default in boot.php
|
||||||
$a->backend = false;
|
$a = new App(__DIR__, false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to open the database;
|
* Try to open the database;
|
||||||
|
@ -36,7 +34,7 @@ $a->backend = false;
|
||||||
require_once "include/dba.php";
|
require_once "include/dba.php";
|
||||||
|
|
||||||
// Missing DB connection: ERROR
|
// Missing DB connection: ERROR
|
||||||
if ($a->mode & App::MODE_LOCALCONFIGPRESENT && !($a->mode & App::MODE_DBAVAILABLE)) {
|
if ($a->getMode()->has(App\Mode::LOCALCONFIGPRESENT) && !$a->getMode()->has(App\Mode::DBAVAILABLE)) {
|
||||||
System::httpExit(500, ['title' => 'Error 500 - Internal Server Error', 'description' => 'Apologies but the website is unavailable at the moment.']);
|
System::httpExit(500, ['title' => 'Error 500 - Internal Server Error', 'description' => 'Apologies but the website is unavailable at the moment.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +46,12 @@ if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
|
||||||
System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']);
|
System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$a->isInstallMode()) {
|
if (strstr($a->query_string, '.well-known/host-meta') && ($a->query_string != '.well-known/host-meta')) {
|
||||||
if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
|
System::httpExit(404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$a->getMode()->isInstall()) {
|
||||||
|
if (Config::get('system', 'force_ssl') && ($a->getScheme() == "http")
|
||||||
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
|
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
|
||||||
&& (substr(System::baseUrl(), 0, 8) == "https://")
|
&& (substr(System::baseUrl(), 0, 8) == "https://")
|
||||||
&& ($_SERVER['REQUEST_METHOD'] == 'GET')) {
|
&& ($_SERVER['REQUEST_METHOD'] == 'GET')) {
|
||||||
|
@ -78,10 +80,10 @@ L10n::loadTranslationTable($lang);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Exclude the backend processes from the session management
|
// Exclude the backend processes from the session management
|
||||||
if (!$a->is_backend()) {
|
if (!$a->isBackend()) {
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
session_start();
|
session_start();
|
||||||
$a->save_timestamp($stamp1, "parser");
|
$a->saveTimestamp($stamp1, "parser");
|
||||||
} else {
|
} else {
|
||||||
$_SESSION = [];
|
$_SESSION = [];
|
||||||
Worker::executeIfIdle();
|
Worker::executeIfIdle();
|
||||||
|
@ -91,7 +93,7 @@ if (!$a->is_backend()) {
|
||||||
* Language was set earlier, but we can over-ride it in the session.
|
* Language was set earlier, but we can over-ride it in the session.
|
||||||
* We have to do it here because the session was just now opened.
|
* We have to do it here because the session was just now opened.
|
||||||
*/
|
*/
|
||||||
if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
|
if (!empty($_SESSION['authenticated']) && empty($_SESSION['language'])) {
|
||||||
$_SESSION['language'] = $lang;
|
$_SESSION['language'] = $lang;
|
||||||
// we haven't loaded user data yet, but we need user language
|
// we haven't loaded user data yet, but we need user language
|
||||||
if (!empty($_SESSION['uid'])) {
|
if (!empty($_SESSION['uid'])) {
|
||||||
|
@ -102,12 +104,12 @@ if (x($_SESSION, 'authenticated') && !x($_SESSION, 'language')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_SESSION, 'language') && ($_SESSION['language'] !== $lang)) {
|
if (!empty($_SESSION['language']) && $_SESSION['language'] !== $lang) {
|
||||||
$lang = $_SESSION['language'];
|
$lang = $_SESSION['language'];
|
||||||
L10n::loadTranslationTable($lang);
|
L10n::loadTranslationTable($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET['zrl']) && $a->mode == App::MODE_NORMAL) {
|
if (!empty($_GET['zrl']) && $a->getMode()->isNormal()) {
|
||||||
$a->query_string = Profile::stripZrls($a->query_string);
|
$a->query_string = Profile::stripZrls($a->query_string);
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
// Only continue when the given profile link seems valid
|
// Only continue when the given profile link seems valid
|
||||||
|
@ -125,12 +127,12 @@ if (!empty($_GET['zrl']) && $a->mode == App::MODE_NORMAL) {
|
||||||
logger("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
|
logger("Invalid ZRL parameter " . $_GET['zrl'], LOGGER_DEBUG);
|
||||||
header('HTTP/1.1 403 Forbidden');
|
header('HTTP/1.1 403 Forbidden');
|
||||||
echo "<h1>403 Forbidden</h1>";
|
echo "<h1>403 Forbidden</h1>";
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x($_GET,'owt')) && $a->mode == App::MODE_NORMAL) {
|
if (!empty($_GET['owt']) && $a->getMode()->isNormal()) {
|
||||||
$token = $_GET['owt'];
|
$token = $_GET['owt'];
|
||||||
$a->query_string = Profile::stripQueryParam($a->query_string, 'owt');
|
$a->query_string = Profile::stripQueryParam($a->query_string, 'owt');
|
||||||
Profile::openWebAuthInit($token);
|
Profile::openWebAuthInit($token);
|
||||||
|
@ -149,14 +151,10 @@ if ((x($_GET,'owt')) && $a->mode == App::MODE_NORMAL) {
|
||||||
|
|
||||||
Login::sessionAuth();
|
Login::sessionAuth();
|
||||||
|
|
||||||
if (! x($_SESSION, 'authenticated')) {
|
if (empty($_SESSION['authenticated'])) {
|
||||||
header('X-Account-Management-Status: none');
|
header('X-Account-Management-Status: none');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set up page['htmlhead'] and page['end'] for the modules to use */
|
|
||||||
$a->page['htmlhead'] = '';
|
|
||||||
$a->page['end'] = '';
|
|
||||||
|
|
||||||
$_SESSION['sysmsg'] = defaults($_SESSION, 'sysmsg' , []);
|
$_SESSION['sysmsg'] = defaults($_SESSION, 'sysmsg' , []);
|
||||||
$_SESSION['sysmsg_info'] = defaults($_SESSION, 'sysmsg_info' , []);
|
$_SESSION['sysmsg_info'] = defaults($_SESSION, 'sysmsg_info' , []);
|
||||||
$_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
|
$_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
|
||||||
|
@ -169,14 +167,14 @@ $_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
|
||||||
|
|
||||||
// in install mode, any url loads install module
|
// in install mode, any url loads install module
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if ($a->isInstallMode() && $a->module!="view") {
|
if ($a->getMode()->isInstall() && $a->module != 'view') {
|
||||||
$a->module = 'install';
|
$a->module = 'install';
|
||||||
} elseif (!($a->mode & App::MODE_MAINTENANCEDISABLED) && $a->module != "view") {
|
} elseif (!$a->getMode()->has(App\Mode::MAINTENANCEDISABLED) && $a->module != 'view') {
|
||||||
$a->module = 'maintenance';
|
$a->module = 'maintenance';
|
||||||
} else {
|
} else {
|
||||||
check_url($a);
|
check_url($a);
|
||||||
check_db(false);
|
check_db(false);
|
||||||
check_addons($a);
|
Addon::check();
|
||||||
}
|
}
|
||||||
|
|
||||||
Nav::setSelected('nothing');
|
Nav::setSelected('nothing');
|
||||||
|
@ -295,11 +293,11 @@ if (strlen($a->module)) {
|
||||||
|
|
||||||
if (! $a->module_loaded) {
|
if (! $a->module_loaded) {
|
||||||
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
|
// Stupid browser tried to pre-fetch our Javascript img template. Don't log the event or return anything - just quietly exit.
|
||||||
if ((x($_SERVER, 'QUERY_STRING')) && preg_match('/{[0-9]}/', $_SERVER['QUERY_STRING']) !== 0) {
|
if (!empty($_SERVER['QUERY_STRING']) && preg_match('/{[0-9]}/', $_SERVER['QUERY_STRING']) !== 0) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((x($_SERVER, 'QUERY_STRING')) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
|
if (!empty($_SERVER['QUERY_STRING']) && ($_SERVER['QUERY_STRING'] === 'q=internal_error.html') && isset($dreamhost_error_hack)) {
|
||||||
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
logger('index.php: dreamhost_error_hack invoked. Original URI =' . $_SERVER['REQUEST_URI']);
|
||||||
goaway(System::baseUrl() . $_SERVER['REQUEST_URI']);
|
goaway(System::baseUrl() . $_SERVER['REQUEST_URI']);
|
||||||
}
|
}
|
||||||
|
@ -307,11 +305,9 @@ if (strlen($a->module)) {
|
||||||
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
|
logger('index.php: page not found: ' . $_SERVER['REQUEST_URI'] . ' ADDRESS: ' . $_SERVER['REMOTE_ADDR'] . ' QUERY: ' . $_SERVER['QUERY_STRING'], LOGGER_DEBUG);
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
|
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
|
||||||
$tpl = get_markup_template("404.tpl");
|
$tpl = get_markup_template("404.tpl");
|
||||||
$a->page['content'] = replace_macros(
|
$a->page['content'] = replace_macros($tpl, [
|
||||||
$tpl,
|
'$message' => L10n::t('Page not found.')
|
||||||
[
|
]);
|
||||||
'$message' => L10n::t('Page not found.')]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,11 +322,7 @@ if (file_exists($theme_info_file)) {
|
||||||
|
|
||||||
/* initialise content region */
|
/* initialise content region */
|
||||||
|
|
||||||
if (! x($a->page, 'content')) {
|
if ($a->getMode()->isNormal()) {
|
||||||
$a->page['content'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($a->mode == App::MODE_NORMAL) {
|
|
||||||
Addon::callHooks('page_content_top', $a->page['content']);
|
Addon::callHooks('page_content_top', $a->page['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,15 +334,21 @@ if ($a->module_loaded) {
|
||||||
$a->page['page_title'] = $a->module;
|
$a->page['page_title'] = $a->module;
|
||||||
$placeholder = '';
|
$placeholder = '';
|
||||||
|
|
||||||
|
Addon::callHooks($a->module . '_mod_init', $placeholder);
|
||||||
|
|
||||||
if ($a->module_class) {
|
if ($a->module_class) {
|
||||||
Addon::callHooks($a->module . '_mod_init', $placeholder);
|
|
||||||
call_user_func([$a->module_class, 'init']);
|
call_user_func([$a->module_class, 'init']);
|
||||||
} else if (function_exists($a->module . '_init')) {
|
} else if (function_exists($a->module . '_init')) {
|
||||||
Addon::callHooks($a->module . '_mod_init', $placeholder);
|
|
||||||
$func = $a->module . '_init';
|
$func = $a->module . '_init';
|
||||||
$func($a);
|
$func($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "rawContent" is especially meant for technical endpoints.
|
||||||
|
// This endpoint doesn't need any theme initialization or other comparable stuff.
|
||||||
|
if (!$a->error && $a->module_class) {
|
||||||
|
call_user_func([$a->module_class, 'rawContent']);
|
||||||
|
}
|
||||||
|
|
||||||
if (function_exists(str_replace('-', '_', $a->getCurrentTheme()) . '_init')) {
|
if (function_exists(str_replace('-', '_', $a->getCurrentTheme()) . '_init')) {
|
||||||
$func = str_replace('-', '_', $a->getCurrentTheme()) . '_init';
|
$func = str_replace('-', '_', $a->getCurrentTheme()) . '_init';
|
||||||
$func($a);
|
$func($a);
|
||||||
|
@ -405,24 +403,13 @@ if ($a->module_loaded) {
|
||||||
* theme choices made by the modules can take effect.
|
* theme choices made by the modules can take effect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$a->init_pagehead();
|
$a->initHead();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build the page ending -- this is stuff that goes right before
|
* Build the page ending -- this is stuff that goes right before
|
||||||
* the closing </body> tag
|
* the closing </body> tag
|
||||||
*/
|
*/
|
||||||
$a->init_page_end();
|
$a->initFooter();
|
||||||
|
|
||||||
// If you're just visiting, let javascript take you home
|
|
||||||
if (x($_SESSION, 'visitor_home')) {
|
|
||||||
$homebase = $_SESSION['visitor_home'];
|
|
||||||
} elseif (local_user()) {
|
|
||||||
$homebase = 'profile/' . $a->user['nickname'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($homebase)) {
|
|
||||||
$a->page['content'] .= '<script>var homebase="' . $homebase . '" ; </script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now that we've been through the module content, see if the page reported
|
* now that we've been through the module content, see if the page reported
|
||||||
|
@ -444,36 +431,9 @@ if ($a->module != 'install' && $a->module != 'maintenance') {
|
||||||
Nav::build($a);
|
Nav::build($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Add a "toggle mobile" link if we're using a mobile device
|
|
||||||
*/
|
|
||||||
if ($a->is_mobile || $a->is_tablet) {
|
|
||||||
if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
|
|
||||||
$link = 'toggle_mobile?address=' . curPageURL();
|
|
||||||
} else {
|
|
||||||
$link = 'toggle_mobile?off=1&address=' . curPageURL();
|
|
||||||
}
|
|
||||||
$a->page['footer'] = replace_macros(
|
|
||||||
get_markup_template("toggle_mobile_footer.tpl"),
|
|
||||||
[
|
|
||||||
'$toggle_link' => $link,
|
|
||||||
'$toggle_text' => L10n::t('toggle mobile')]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the page - now that we have all the components
|
* Build the page - now that we have all the components
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!$a->theme['stylesheet']) {
|
|
||||||
$stylesheet = $a->getCurrentThemeStylesheetPath();
|
|
||||||
} else {
|
|
||||||
$stylesheet = $a->theme['stylesheet'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->page['htmlhead'] = str_replace('{{$stylesheet}}', $stylesheet, $a->page['htmlhead']);
|
|
||||||
//$a->page['htmlhead'] = replace_macros($a->page['htmlhead'], array('$stylesheet' => $stylesheet));
|
|
||||||
|
|
||||||
if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) {
|
if (isset($_GET["mode"]) && (($_GET["mode"] == "raw") || ($_GET["mode"] == "minimal"))) {
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
|
|
||||||
|
@ -502,7 +462,7 @@ if (isset($_GET["mode"]) && ($_GET["mode"] == "raw")) {
|
||||||
|
|
||||||
echo substr($target->saveHTML(), 6, -8);
|
echo substr($target->saveHTML(), 6, -8);
|
||||||
|
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = $a->page;
|
$page = $a->page;
|
||||||
|
@ -540,5 +500,3 @@ if (empty($template)) {
|
||||||
|
|
||||||
/// @TODO Looks unsafe (remote-inclusion), is maybe not but Theme::getPathForFile() uses file_exists() but does not escape anything
|
/// @TODO Looks unsafe (remote-inclusion), is maybe not but Theme::getPathForFile() uses file_exists() but does not escape anything
|
||||||
require_once $template;
|
require_once $template;
|
||||||
|
|
||||||
killme();
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Network\Probe;
|
|
||||||
|
|
||||||
function acctlink_init()
|
|
||||||
{
|
|
||||||
if (x($_GET, 'addr')) {
|
|
||||||
$addr = trim($_GET['addr']);
|
|
||||||
$res = Probe::uri($addr);
|
|
||||||
if ($res['url']) {
|
|
||||||
goaway($res['url']);
|
|
||||||
killme();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -83,8 +83,9 @@ function acl_content(App $a)
|
||||||
WHERE `uid` = %d AND NOT `self`
|
WHERE `uid` = %d AND NOT `self`
|
||||||
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||||
AND `success_update` >= `failure_update`
|
AND `success_update` >= `failure_update`
|
||||||
AND `network` IN ('%s', '%s') $sql_extra2",
|
AND `network` IN ('%s', '%s', '%s') $sql_extra2",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
DBA::escape(Protocol::ACTIVITYPUB),
|
||||||
DBA::escape(Protocol::DFRN),
|
DBA::escape(Protocol::DFRN),
|
||||||
DBA::escape(Protocol::DIASPORA)
|
DBA::escape(Protocol::DIASPORA)
|
||||||
);
|
);
|
||||||
|
@ -169,10 +170,11 @@ function acl_content(App $a)
|
||||||
} elseif ($type == 'm') {
|
} elseif ($type == 'm') {
|
||||||
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
|
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `addr` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
|
||||||
AND `success_update` >= `failure_update` AND `network` IN ('%s', '%s')
|
AND `success_update` >= `failure_update` AND `network` IN ('%s', '%s', '%s')
|
||||||
$sql_extra2
|
$sql_extra2
|
||||||
ORDER BY `name` ASC ",
|
ORDER BY `name` ASC ",
|
||||||
intval(local_user()),
|
intval(local_user()),
|
||||||
|
DBA::escape(Protocol::ACTIVITYPUB),
|
||||||
DBA::escape(Protocol::DFRN),
|
DBA::escape(Protocol::DFRN),
|
||||||
DBA::escape(Protocol::DIASPORA)
|
DBA::escape(Protocol::DIASPORA)
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,13 +18,14 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
use Friendica\Model\Register;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
use Friendica\Module\Tos;
|
use Friendica\Module\Tos;
|
||||||
use Friendica\Util\Arrays;
|
use Friendica\Util\Arrays;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Temporal;
|
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
|
@ -33,11 +34,11 @@ require_once 'include/items.php';
|
||||||
/**
|
/**
|
||||||
* @brief Process send data from the admin panels subpages
|
* @brief Process send data from the admin panels subpages
|
||||||
*
|
*
|
||||||
* This function acts as relais for processing the data send from the subpages
|
* This function acts as relay for processing the data send from the subpages
|
||||||
* of the admin panel. Depending on the 1st parameter of the url (argv[1])
|
* of the admin panel. Depending on the 1st parameter of the url (argv[1])
|
||||||
* specialized functions are called to process the data from the subpages.
|
* specialized functions are called to process the data from the subpages.
|
||||||
*
|
*
|
||||||
* The function itself does not return anything, but the subsequencely function
|
* The function itself does not return anything, but the subsequently function
|
||||||
* return the HTML for the pages of the admin panel.
|
* return the HTML for the pages of the admin panel.
|
||||||
*
|
*
|
||||||
* @param App $a
|
* @param App $a
|
||||||
|
@ -77,7 +78,7 @@ function admin_post(App $a)
|
||||||
break;
|
break;
|
||||||
case 'themes':
|
case 'themes':
|
||||||
if ($a->argc < 2) {
|
if ($a->argc < 2) {
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goaway('admin/');
|
goaway('admin/');
|
||||||
|
@ -107,7 +108,7 @@ function admin_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
info(L10n::t('Theme settings updated.'));
|
info(L10n::t('Theme settings updated.'));
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$return_path = 'admin/themes/' . $theme;
|
$return_path = 'admin/themes/' . $theme;
|
||||||
|
@ -286,7 +287,7 @@ function admin_content(App $a)
|
||||||
$o = admin_page_summary($a);
|
$o = admin_page_summary($a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
echo $o;
|
echo $o;
|
||||||
killme();
|
killme();
|
||||||
return '';
|
return '';
|
||||||
|
@ -475,8 +476,8 @@ function admin_page_contactblock(App $a)
|
||||||
|
|
||||||
$total = DBA::count('contact', $condition);
|
$total = DBA::count('contact', $condition);
|
||||||
|
|
||||||
$a->set_pager_total($total);
|
$a->setPagerTotal($total);
|
||||||
$a->set_pager_itemspage(30);
|
$a->setPagerItemsPage(30);
|
||||||
|
|
||||||
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
|
$statement = DBA::select('contact', [], $condition, ['limit' => [$a->pager['start'], $a->pager['itemspage']]]);
|
||||||
|
|
||||||
|
@ -866,15 +867,15 @@ function admin_page_summary(App $a)
|
||||||
// Legacy config file warning
|
// Legacy config file warning
|
||||||
if (file_exists('.htconfig.php')) {
|
if (file_exists('.htconfig.php')) {
|
||||||
$showwarning = true;
|
$showwarning = true;
|
||||||
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->get_baseurl() . '/help/Config');
|
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->getBaseURL() . '/help/Config');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check server vitality
|
// Check server vitality
|
||||||
if (!admin_page_server_vital()) {
|
if (!admin_page_server_vital()) {
|
||||||
$showwarning = true;
|
$showwarning = true;
|
||||||
$well_known = $a->get_baseurl() . '/.well-known/host-meta';
|
$well_known = $a->getBaseURL() . '/.well-known/host-meta';
|
||||||
$warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
|
$warningtext[] = L10n::t('<a href="%s">%s</a> is not reachable on your system. This is a severe configuration issue that prevents server to server communication. See <a href="%s">the installation page</a> for help.',
|
||||||
$well_known, $well_known, $a->get_baseurl() . '/help/Install');
|
$well_known, $well_known, $a->getBaseURL() . '/help/Install');
|
||||||
}
|
}
|
||||||
|
|
||||||
$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`");
|
||||||
|
@ -895,8 +896,7 @@ function admin_page_summary(App $a)
|
||||||
|
|
||||||
logger('accounts: ' . print_r($accounts, true), LOGGER_DATA);
|
logger('accounts: ' . print_r($accounts, true), LOGGER_DATA);
|
||||||
|
|
||||||
$r = q("SELECT COUNT(`id`) AS `count` FROM `register`");
|
$pending = Register::getPendingCount();
|
||||||
$pending = $r[0]['count'];
|
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
|
$r = q("SELECT COUNT(*) AS `total` FROM `queue` WHERE 1");
|
||||||
$queue = (($r) ? $r[0]['total'] : 0);
|
$queue = (($r) ? $r[0]['total'] : 0);
|
||||||
|
@ -909,6 +909,15 @@ function admin_page_summary(App $a)
|
||||||
$queues = ['label' => L10n::t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue];
|
$queues = ['label' => L10n::t('Message queues'), 'queue' => $queue, 'workerq' => $workerqueue];
|
||||||
|
|
||||||
|
|
||||||
|
$r = q("SHOW variables LIKE 'max_allowed_packet'");
|
||||||
|
$max_allowed_packet = (($r) ? $r[0]['Value'] : 0);
|
||||||
|
|
||||||
|
$server_settings = ['label' => L10n::t('Server Settings'),
|
||||||
|
'php' => ['upload_max_filesize' => ini_get('upload_max_filesize'),
|
||||||
|
'post_max_size' => ini_get('post_max_size'),
|
||||||
|
'memory_limit' => ini_get('memory_limit')],
|
||||||
|
'mysql' => ['max_allowed_packet' => $max_allowed_packet]];
|
||||||
|
|
||||||
$t = get_markup_template('admin/summary.tpl');
|
$t = get_markup_template('admin/summary.tpl');
|
||||||
return replace_macros($t, [
|
return replace_macros($t, [
|
||||||
'$title' => L10n::t('Administration'),
|
'$title' => L10n::t('Administration'),
|
||||||
|
@ -923,6 +932,7 @@ function admin_page_summary(App $a)
|
||||||
'$codename' => FRIENDICA_CODENAME,
|
'$codename' => FRIENDICA_CODENAME,
|
||||||
'$build' => Config::get('system', 'build'),
|
'$build' => Config::get('system', 'build'),
|
||||||
'$addons' => [L10n::t('Active addons'), $a->addons],
|
'$addons' => [L10n::t('Active addons'), $a->addons],
|
||||||
|
'$serversettings' => $server_settings,
|
||||||
'$showwarning' => $showwarning,
|
'$showwarning' => $showwarning,
|
||||||
'$warningtext' => $warningtext
|
'$warningtext' => $warningtext
|
||||||
]);
|
]);
|
||||||
|
@ -1002,7 +1012,7 @@ function admin_page_site_post(App $a)
|
||||||
// update config
|
// update config
|
||||||
Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
|
Config::set('system', 'hostname', parse_url($new_url, PHP_URL_HOST));
|
||||||
Config::set('system', 'url', $new_url);
|
Config::set('system', 'url', $new_url);
|
||||||
$a->set_baseurl($new_url);
|
$a->setBaseURL($new_url);
|
||||||
|
|
||||||
// send relocate
|
// send relocate
|
||||||
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
$users = q("SELECT `uid` FROM `user` WHERE `account_removed` = 0 AND `account_expired` = 0");
|
||||||
|
@ -1114,7 +1124,7 @@ function admin_page_site_post(App $a)
|
||||||
Worker::add(PRIORITY_LOW, 'Directory');
|
Worker::add(PRIORITY_LOW, 'Directory');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->get_path() != "") {
|
if ($a->getURLPath() != "") {
|
||||||
$diaspora_enabled = false;
|
$diaspora_enabled = false;
|
||||||
}
|
}
|
||||||
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
|
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
|
||||||
|
@ -1251,7 +1261,7 @@ function admin_page_site_post(App $a)
|
||||||
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
|
Config::set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
|
||||||
|
|
||||||
if ($itemcache != '') {
|
if ($itemcache != '') {
|
||||||
$itemcache = App::realpath($itemcache);
|
$itemcache = App::getRealPath($itemcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::set('system', 'itemcache', $itemcache);
|
Config::set('system', 'itemcache', $itemcache);
|
||||||
|
@ -1259,13 +1269,13 @@ function admin_page_site_post(App $a)
|
||||||
Config::set('system', 'max_comments', $max_comments);
|
Config::set('system', 'max_comments', $max_comments);
|
||||||
|
|
||||||
if ($temppath != '') {
|
if ($temppath != '') {
|
||||||
$temppath = App::realpath($temppath);
|
$temppath = App::getRealPath($temppath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::set('system', 'temppath', $temppath);
|
Config::set('system', 'temppath', $temppath);
|
||||||
|
|
||||||
if ($basepath != '') {
|
if ($basepath != '') {
|
||||||
$basepath = App::realpath($basepath);
|
$basepath = App::getRealPath($basepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
Config::set('system', 'basepath', $basepath);
|
Config::set('system', 'basepath', $basepath);
|
||||||
|
@ -1409,9 +1419,9 @@ function admin_page_site(App $a)
|
||||||
];
|
];
|
||||||
|
|
||||||
if (empty(Config::get('config', 'hostname'))) {
|
if (empty(Config::get('config', 'hostname'))) {
|
||||||
Config::set('config', 'hostname', $a->get_hostname());
|
Config::set('config', 'hostname', $a->getHostName());
|
||||||
}
|
}
|
||||||
$diaspora_able = ($a->get_path() == "");
|
$diaspora_able = ($a->getURLPath() == "");
|
||||||
|
|
||||||
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
|
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);
|
||||||
|
|
||||||
|
@ -1478,7 +1488,7 @@ function admin_page_site(App $a)
|
||||||
'$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
|
'$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
|
||||||
'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
|
'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
|
||||||
'$ostatus_disabled' => ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
|
'$ostatus_disabled' => ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
|
||||||
'$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")],
|
'$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus/ActivityPub threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus and ActivityPub contacts. With this option we only store threads that are started by a contact that is known on our system.")],
|
||||||
'$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."),
|
'$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."),
|
||||||
'$diaspora_able' => $diaspora_able,
|
'$diaspora_able' => $diaspora_able,
|
||||||
'$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
|
'$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
|
||||||
|
@ -1782,17 +1792,13 @@ function admin_page_users(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get pending */
|
/* get pending */
|
||||||
$pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`
|
$pending = Register::getPending();
|
||||||
FROM `register`
|
|
||||||
INNER JOIN `contact` ON `register`.`uid` = `contact`.`uid`
|
|
||||||
INNER JOIN `user` ON `register`.`uid` = `user`.`uid`;");
|
|
||||||
|
|
||||||
|
|
||||||
/* get users */
|
/* get users */
|
||||||
$total = q("SELECT COUNT(*) AS `total` FROM `user` WHERE 1");
|
$total = q("SELECT COUNT(*) AS `total` FROM `user` WHERE 1");
|
||||||
if (count($total)) {
|
if (count($total)) {
|
||||||
$a->set_pager_total($total[0]['total']);
|
$a->setPagerTotal($total[0]['total']);
|
||||||
$a->set_pager_itemspage(100);
|
$a->setPagerItemsPage(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ordering */
|
/* ordering */
|
||||||
|
@ -1912,7 +1918,7 @@ function admin_page_users(App $a)
|
||||||
|
|
||||||
'$h_users' => L10n::t('Users'),
|
'$h_users' => L10n::t('Users'),
|
||||||
'$h_newuser' => L10n::t('New User'),
|
'$h_newuser' => L10n::t('New User'),
|
||||||
'$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Deleted since')],
|
'$th_deleted' => [L10n::t('Name'), L10n::t('Email'), L10n::t('Register date'), L10n::t('Last login'), L10n::t('Last item'), L10n::t('Delete in')],
|
||||||
'$th_users' => $th_users,
|
'$th_users' => $th_users,
|
||||||
'$order_users' => $order,
|
'$order_users' => $order,
|
||||||
'$order_direction_users' => $order_direction,
|
'$order_direction_users' => $order_direction,
|
||||||
|
@ -2526,7 +2532,7 @@ function admin_page_features_post(App $a)
|
||||||
*/
|
*/
|
||||||
function admin_page_features(App $a)
|
function admin_page_features(App $a)
|
||||||
{
|
{
|
||||||
if ((argc() > 1) && (argv(1) === 'features')) {
|
if (($a->argc > 1) && ($a->getArgumentValue(1) === 'features')) {
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$features = Feature::get(false);
|
$features = Feature::get(false);
|
||||||
|
|
||||||
|
@ -2557,6 +2563,5 @@ function admin_page_features(App $a)
|
||||||
function admin_page_server_vital()
|
function admin_page_server_vital()
|
||||||
{
|
{
|
||||||
// Fetch the host-meta to check if this really is a vital server
|
// Fetch the host-meta to check if this really is a vital server
|
||||||
$serverret = Network::curl(System::baseUrl() . '/.well-known/host-meta');
|
return Network::curl(System::baseUrl() . '/.well-known/host-meta')->isSuccess();
|
||||||
return $serverret["success"];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,12 @@ use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Module;
|
||||||
use Friendica\Model\Profile;
|
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
function allfriends_content(App $a)
|
function allfriends_content(App $a)
|
||||||
{
|
{
|
||||||
|
@ -42,13 +41,13 @@ function allfriends_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = "";
|
||||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
|
||||||
|
|
||||||
$total = GContact::countAllFriends(local_user(), $cid);
|
$total = Model\GContact::countAllFriends(local_user(), $cid);
|
||||||
|
|
||||||
$a->set_pager_total($total);
|
$a->setPagerTotal($total);
|
||||||
|
|
||||||
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
$r = Model\GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
$o .= L10n::t('No friends to display.');
|
$o .= L10n::t('No friends to display.');
|
||||||
return $o;
|
return $o;
|
||||||
|
@ -59,7 +58,7 @@ function allfriends_content(App $a)
|
||||||
$entries = [];
|
$entries = [];
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
//get further details of the contact
|
//get further details of the contact
|
||||||
$contact_details = Contact::getDetailsByURL($rr['url'], $uid, $rr);
|
$contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid, $rr);
|
||||||
|
|
||||||
$photo_menu = '';
|
$photo_menu = '';
|
||||||
|
|
||||||
|
@ -68,11 +67,11 @@ function allfriends_content(App $a)
|
||||||
// If the contact is not common to the user, Connect/Follow' will be added to the photo menu
|
// If the contact is not common to the user, Connect/Follow' will be added to the photo menu
|
||||||
if ($rr['cid']) {
|
if ($rr['cid']) {
|
||||||
$rr['id'] = $rr['cid'];
|
$rr['id'] = $rr['cid'];
|
||||||
$photo_menu = Contact::photoMenu($rr);
|
$photo_menu = Model\Contact::photoMenu($rr);
|
||||||
} else {
|
} else {
|
||||||
$connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
|
$connlnk = System::baseUrl() . '/follow/?url=' . $rr['url'];
|
||||||
$photo_menu = [
|
$photo_menu = [
|
||||||
'profile' => [L10n::t("View Profile"), Contact::magicLink($rr['url'])],
|
'profile' => [L10n::t("View Profile"), Model\Contact::magicLink($rr['url'])],
|
||||||
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
'follow' => [L10n::t("Connect/Follow"), $connlnk]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -86,7 +85,7 @@ function allfriends_content(App $a)
|
||||||
'details' => $contact_details['location'],
|
'details' => $contact_details['location'],
|
||||||
'tags' => $contact_details['keywords'],
|
'tags' => $contact_details['keywords'],
|
||||||
'about' => $contact_details['about'],
|
'about' => $contact_details['about'],
|
||||||
'account_type' => Contact::getAccountType($contact_details),
|
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||||
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
||||||
'photo_menu' => $photo_menu,
|
'photo_menu' => $photo_menu,
|
||||||
'conntxt' => L10n::t('Connect'),
|
'conntxt' => L10n::t('Connect'),
|
||||||
|
@ -96,7 +95,7 @@ function allfriends_content(App $a)
|
||||||
$entries[] = $entry;
|
$entries[] = $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tab_str = contacts_tab($a, $contact, 4);
|
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
|
||||||
|
|
||||||
$tpl = get_markup_template('viewcontact_template.tpl');
|
$tpl = get_markup_template('viewcontact_template.tpl');
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
use Friendica\Content\Text;
|
use Friendica\Content\Text;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
|
||||||
function visible_lf($s)
|
function visible_whitespace($s)
|
||||||
{
|
{
|
||||||
return str_replace("\n", '<br />', $s);
|
$s = str_replace(' ', ' ', $s);
|
||||||
|
|
||||||
|
return str_replace(["\r\n", "\n", "\r"], '<br />', $s);
|
||||||
}
|
}
|
||||||
|
|
||||||
function babel_content()
|
function babel_content()
|
||||||
|
@ -20,19 +22,19 @@ function babel_content()
|
||||||
$bbcode = trim($_REQUEST['text']);
|
$bbcode = trim($_REQUEST['text']);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Source input'),
|
'title' => L10n::t('Source input'),
|
||||||
'content' => visible_lf($bbcode)
|
'content' => visible_whitespace($bbcode)
|
||||||
];
|
];
|
||||||
|
|
||||||
$plain = Text\BBCode::toPlaintext($bbcode, false);
|
$plain = Text\BBCode::toPlaintext($bbcode, false);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('BBCode::toPlaintext'),
|
'title' => L10n::t('BBCode::toPlaintext'),
|
||||||
'content' => visible_lf($plain)
|
'content' => visible_whitespace($plain)
|
||||||
];
|
];
|
||||||
|
|
||||||
$html = Text\BBCode::convert($bbcode);
|
$html = Text\BBCode::convert($bbcode);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t("BBCode::convert \x28raw HTML\x29"),
|
'title' => L10n::t('BBCode::convert (raw HTML)'),
|
||||||
'content' => htmlspecialchars($html)
|
'content' => visible_whitespace(htmlspecialchars($html))
|
||||||
];
|
];
|
||||||
|
|
||||||
$results[] = [
|
$results[] = [
|
||||||
|
@ -43,13 +45,13 @@ function babel_content()
|
||||||
$bbcode2 = Text\HTML::toBBCode($html);
|
$bbcode2 = Text\HTML::toBBCode($html);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
|
'title' => L10n::t('BBCode::convert => HTML::toBBCode'),
|
||||||
'content' => visible_lf($bbcode2)
|
'content' => visible_whitespace($bbcode2)
|
||||||
];
|
];
|
||||||
|
|
||||||
$markdown = Text\BBCode::toMarkdown($bbcode);
|
$markdown = Text\BBCode::toMarkdown($bbcode);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('BBCode::toMarkdown'),
|
'title' => L10n::t('BBCode::toMarkdown'),
|
||||||
'content' => visible_lf($markdown)
|
'content' => visible_whitespace($markdown)
|
||||||
];
|
];
|
||||||
|
|
||||||
$html2 = Text\Markdown::convert($markdown);
|
$html2 = Text\Markdown::convert($markdown);
|
||||||
|
@ -61,22 +63,33 @@ function babel_content()
|
||||||
$bbcode3 = Text\Markdown::toBBCode($markdown);
|
$bbcode3 = Text\Markdown::toBBCode($markdown);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
|
'title' => L10n::t('BBCode::toMarkdown => Markdown::toBBCode'),
|
||||||
'content' => visible_lf($bbcode3)
|
'content' => visible_whitespace($bbcode3)
|
||||||
];
|
];
|
||||||
|
|
||||||
$bbcode4 = Text\HTML::toBBCode($html2);
|
$bbcode4 = Text\HTML::toBBCode($html2);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
|
'title' => L10n::t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'),
|
||||||
'content' => visible_lf($bbcode4)
|
'content' => visible_whitespace($bbcode4)
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'markdown':
|
case 'markdown':
|
||||||
$markdown = trim($_REQUEST['text']);
|
$markdown = trim($_REQUEST['text']);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Source input \x28Diaspora format\x29'),
|
'title' => L10n::t('Source input (Diaspora format)'),
|
||||||
'content' => '<pre>' . $markdown . '</pre>'
|
'content' => '<pre>' . $markdown . '</pre>'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$html = Text\Markdown::convert($markdown);
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('Markdown::convert (raw HTML)'),
|
||||||
|
'content' => htmlspecialchars($html)
|
||||||
|
];
|
||||||
|
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('Markdown::convert'),
|
||||||
|
'content' => $html
|
||||||
|
];
|
||||||
|
|
||||||
$bbcode = Text\Markdown::toBBCode($markdown);
|
$bbcode = Text\Markdown::toBBCode($markdown);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('Markdown::toBBCode'),
|
'title' => L10n::t('Markdown::toBBCode'),
|
||||||
|
@ -86,7 +99,7 @@ function babel_content()
|
||||||
case 'html' :
|
case 'html' :
|
||||||
$html = trim($_REQUEST['text']);
|
$html = trim($_REQUEST['text']);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t("Raw HTML input"),
|
'title' => L10n::t('Raw HTML input'),
|
||||||
'content' => htmlspecialchars($html)
|
'content' => htmlspecialchars($html)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -98,7 +111,24 @@ function babel_content()
|
||||||
$bbcode = Text\HTML::toBBCode($html);
|
$bbcode = Text\HTML::toBBCode($html);
|
||||||
$results[] = [
|
$results[] = [
|
||||||
'title' => L10n::t('HTML::toBBCode'),
|
'title' => L10n::t('HTML::toBBCode'),
|
||||||
'content' => visible_lf($bbcode)
|
'content' => visible_whitespace($bbcode)
|
||||||
|
];
|
||||||
|
|
||||||
|
$html2 = Text\BBCode::convert($bbcode);
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('HTML::toBBCode => BBCode::convert'),
|
||||||
|
'content' => $html2
|
||||||
|
];
|
||||||
|
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('HTML::toBBCode => BBCode::convert (raw HTML)'),
|
||||||
|
'content' => htmlspecialchars($html2)
|
||||||
|
];
|
||||||
|
|
||||||
|
$markdown = Text\HTML::toMarkdown($html);
|
||||||
|
$results[] = [
|
||||||
|
'title' => L10n::t('HTML::toMarkdown'),
|
||||||
|
'content' => visible_whitespace($markdown)
|
||||||
];
|
];
|
||||||
|
|
||||||
$text = Text\HTML::toPlaintext($html);
|
$text = Text\HTML::toPlaintext($html);
|
||||||
|
@ -111,7 +141,7 @@ function babel_content()
|
||||||
|
|
||||||
$tpl = get_markup_template('babel.tpl');
|
$tpl = get_markup_template('babel.tpl');
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$text' => ['text', L10n::t('Source text'), defaults($_REQUEST, 'text', ''), ''],
|
'$text' => ['text', L10n::t('Source text'), htmlentities(defaults($_REQUEST, 'text', '')), ''],
|
||||||
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
|
'$type_bbcode' => ['type', L10n::t('BBCode'), 'bbcode', '', defaults($_REQUEST, 'type', 'bbcode') == 'bbcode'],
|
||||||
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
|
'$type_markdown' => ['type', L10n::t('Markdown'), 'markdown', '', defaults($_REQUEST, 'type', 'bbcode') == 'markdown'],
|
||||||
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
|
'$type_html' => ['type', L10n::t('HTML'), 'html', '', defaults($_REQUEST, 'type', 'bbcode') == 'html'],
|
||||||
|
|
|
@ -30,6 +30,10 @@ function bookmarklet_content(App $a)
|
||||||
$page = normalise_link(System::baseUrl() . "/bookmarklet");
|
$page = normalise_link(System::baseUrl() . "/bookmarklet");
|
||||||
|
|
||||||
if (!strstr($referer, $page)) {
|
if (!strstr($referer, $page)) {
|
||||||
|
if (empty($_REQUEST["url"])) {
|
||||||
|
System::httpExit(400, ["title" => L10n::t('Bad Request')]);
|
||||||
|
}
|
||||||
|
|
||||||
$content = add_page_info($_REQUEST["url"]);
|
$content = add_page_info($_REQUEST["url"]);
|
||||||
|
|
||||||
$x = [
|
$x = [
|
||||||
|
|
|
@ -94,11 +94,6 @@ function cal_content(App $a)
|
||||||
'$i18n' => $i18n,
|
'$i18n' => $i18n,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$etpl = get_markup_template('event_end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($etpl, [
|
|
||||||
'$baseurl' => System::baseUrl(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$mode = 'view';
|
$mode = 'view';
|
||||||
$y = 0;
|
$y = 0;
|
||||||
$m = 0;
|
$m = 0;
|
||||||
|
|
|
@ -7,13 +7,12 @@ use Friendica\App;
|
||||||
use Friendica\Content\ContactSelector;
|
use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Module;
|
||||||
use Friendica\Model\Profile;
|
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
function common_content(App $a)
|
function common_content(App $a)
|
||||||
{
|
{
|
||||||
|
@ -42,16 +41,16 @@ function common_content(App $a)
|
||||||
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = "";
|
||||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
|
$contact = DBA::selectFirst('contact', ['name', 'url', 'photo', 'uid', 'id'], ['self' => true, 'uid' => $uid]);
|
||||||
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
|
$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"), [
|
||||||
'$name' => htmlentities($contact['name']),
|
'$name' => htmlentities($contact['name']),
|
||||||
'$photo' => $contact['photo'],
|
'$photo' => $contact['photo'],
|
||||||
'url' => 'contacts/' . $cid
|
'url' => 'contact/' . $cid
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!x($a->page, 'aside')) {
|
if (!x($a->page, 'aside')) {
|
||||||
|
@ -65,12 +64,12 @@ function common_content(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$cid && Profile::getMyURL()) {
|
if (!$cid && Model\Profile::getMyURL()) {
|
||||||
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Profile::getMyURL()), 'uid' => $uid]);
|
$contact = DBA::selectFirst('contact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL()), 'uid' => $uid]);
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$cid = $contact['id'];
|
$cid = $contact['id'];
|
||||||
} else {
|
} else {
|
||||||
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Profile::getMyURL())]);
|
$gcontact = DBA::selectFirst('gcontact', ['id'], ['nurl' => normalise_link(Model\Profile::getMyURL())]);
|
||||||
if (DBA::isResult($gcontact)) {
|
if (DBA::isResult($gcontact)) {
|
||||||
$zcid = $gcontact['id'];
|
$zcid = $gcontact['id'];
|
||||||
}
|
}
|
||||||
|
@ -82,22 +81,22 @@ function common_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$t = GContact::countCommonFriends($uid, $cid);
|
$t = Model\GContact::countCommonFriends($uid, $cid);
|
||||||
} else {
|
} else {
|
||||||
$t = GContact::countCommonFriendsZcid($uid, $zcid);
|
$t = Model\GContact::countCommonFriendsZcid($uid, $zcid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($t > 0) {
|
if ($t > 0) {
|
||||||
$a->set_pager_total($t);
|
$a->setPagerTotal($t);
|
||||||
} else {
|
} else {
|
||||||
notice(L10n::t('No contacts in common.') . EOL);
|
notice(L10n::t('No contacts in common.') . EOL);
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$r = GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
$r = Model\GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
} else {
|
} else {
|
||||||
$r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
$r = Model\GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
|
@ -109,13 +108,13 @@ function common_content(App $a)
|
||||||
$entries = [];
|
$entries = [];
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
//get further details of the contact
|
//get further details of the contact
|
||||||
$contact_details = Contact::getDetailsByURL($rr['url'], $uid);
|
$contact_details = Model\Contact::getDetailsByURL($rr['url'], $uid);
|
||||||
|
|
||||||
// $rr['id'] is needed to use contact_photo_menu()
|
// $rr['id'] is needed to use contact_photo_menu()
|
||||||
/// @TODO Adding '/" here avoids E_NOTICE on missing constants
|
/// @TODO Adding '/" here avoids E_NOTICE on missing constants
|
||||||
$rr['id'] = $rr['cid'];
|
$rr['id'] = $rr['cid'];
|
||||||
|
|
||||||
$photo_menu = Contact::photoMenu($rr);
|
$photo_menu = Model\Contact::photoMenu($rr);
|
||||||
|
|
||||||
$entry = [
|
$entry = [
|
||||||
'url' => $rr['url'],
|
'url' => $rr['url'],
|
||||||
|
@ -126,7 +125,7 @@ function common_content(App $a)
|
||||||
'details' => $contact_details['location'],
|
'details' => $contact_details['location'],
|
||||||
'tags' => $contact_details['keywords'],
|
'tags' => $contact_details['keywords'],
|
||||||
'about' => $contact_details['about'],
|
'about' => $contact_details['about'],
|
||||||
'account_type' => Contact::getAccountType($contact_details),
|
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||||
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
'network' => ContactSelector::networkToName($contact_details['network'], $contact_details['url']),
|
||||||
'photo_menu' => $photo_menu,
|
'photo_menu' => $photo_menu,
|
||||||
'id' => ++$id,
|
'id' => ++$id,
|
||||||
|
@ -137,7 +136,7 @@ function common_content(App $a)
|
||||||
$title = '';
|
$title = '';
|
||||||
$tab_str = '';
|
$tab_str = '';
|
||||||
if ($cmd === 'loc' && $cid && local_user() == $uid) {
|
if ($cmd === 'loc' && $cid && local_user() == $uid) {
|
||||||
$tab_str = contacts_tab($a, $contact, 4);
|
$tab_str = Module\Contact::getTabsHTML($a, $contact, 4);
|
||||||
} else {
|
} else {
|
||||||
$title = L10n::t('Common Friends');
|
$title = L10n::t('Common Friends');
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ function community_content(App $a, $update = 0)
|
||||||
$itemspage_network = $a->force_max_items;
|
$itemspage_network = $a->force_max_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_pager_itemspage($itemspage_network);
|
$a->setPagerItemsPage($itemspage_network);
|
||||||
|
|
||||||
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content, $accounttype);
|
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content, $accounttype);
|
||||||
|
|
||||||
|
|
1139
mod/contacts.php
1139
mod/contacts.php
File diff suppressed because it is too large
Load diff
|
@ -8,10 +8,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Module;
|
||||||
|
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
function crepair_init(App $a)
|
function crepair_init(App $a)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +28,7 @@ function crepair_init(App $a)
|
||||||
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$a->data['contact'] = $contact;
|
$a->data['contact'] = $contact;
|
||||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
Model\Profile::load($a, "", 0, Model\Contact::getDetailsByURL($contact["url"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +80,7 @@ function crepair_post(App $a)
|
||||||
if ($photo) {
|
if ($photo) {
|
||||||
logger('mod-crepair: updating photo from ' . $photo);
|
logger('mod-crepair: updating photo from ' . $photo);
|
||||||
|
|
||||||
Contact::updateAvatar($photo, local_user(), $contact['id']);
|
Model\Contact::updateAvatar($photo, local_user(), $contact['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
@ -116,7 +114,7 @@ function crepair_content(App $a)
|
||||||
$warning = L10n::t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
|
$warning = L10n::t('<strong>WARNING: This is highly advanced</strong> and if you enter incorrect information your communications with this contact may stop working.');
|
||||||
$info = L10n::t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');
|
$info = L10n::t('Please use your browser \'Back\' button <strong>now</strong> if you are uncertain what to do on this page.');
|
||||||
|
|
||||||
$returnaddr = "contacts/$cid";
|
$returnaddr = "contact/$cid";
|
||||||
|
|
||||||
$allow_remote_self = Config::get('system', 'allow_users_remote_self');
|
$allow_remote_self = Config::get('system', 'allow_users_remote_self');
|
||||||
|
|
||||||
|
@ -133,9 +131,9 @@ function crepair_content(App $a)
|
||||||
$remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')];
|
$remote_self_options = ['0' => L10n::t('No mirroring'), '2' => L10n::t('Mirror as my own posting')];
|
||||||
}
|
}
|
||||||
|
|
||||||
$update_profile = in_array($contact['network'], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
|
$update_profile = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]);
|
||||||
|
|
||||||
$tab_str = contacts_tab($a, $contact, 5);
|
$tab_str = Module\Contact::getTabsHTML($a, $contact, 5);
|
||||||
|
|
||||||
$tpl = get_markup_template('crepair.tpl');
|
$tpl = get_markup_template('crepair.tpl');
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Model\Group;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
@ -220,7 +221,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$res = Network::post($dfrn_confirm, $params, null, $redirects, 120);
|
$res = Network::post($dfrn_confirm, $params, null, $redirects, 120)->getBody();
|
||||||
|
|
||||||
logger(' Confirm: received data: ' . $res, LOGGER_DATA);
|
logger(' Confirm: received data: ' . $res, LOGGER_DATA);
|
||||||
|
|
||||||
|
@ -335,10 +336,17 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
if ($network == Protocol::ACTIVITYPUB) {
|
||||||
|
ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
|
||||||
|
$pending = true;
|
||||||
|
} else {
|
||||||
|
$pending = false;
|
||||||
|
}
|
||||||
|
|
||||||
// $network !== Protocol::DFRN
|
// $network !== Protocol::DFRN
|
||||||
$network = defaults($contact, 'network', Protocol::OSTATUS);
|
$network = defaults($contact, 'network', Protocol::OSTATUS);
|
||||||
|
|
||||||
$arr = Probe::uri($contact['url']);
|
$arr = Probe::uri($contact['url'], $network);
|
||||||
|
|
||||||
$notify = defaults($contact, 'notify' , $arr['notify']);
|
$notify = defaults($contact, 'notify' , $arr['notify']);
|
||||||
$poll = defaults($contact, 'poll' , $arr['poll']);
|
$poll = defaults($contact, 'poll' , $arr['poll']);
|
||||||
|
@ -348,7 +356,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
$new_relation = $contact['rel'];
|
$new_relation = $contact['rel'];
|
||||||
$writable = $contact['writable'];
|
$writable = $contact['writable'];
|
||||||
|
|
||||||
if ($network === Protocol::DIASPORA) {
|
if (in_array($network, [Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
||||||
if ($duplex) {
|
if ($duplex) {
|
||||||
$new_relation = Contact::FRIEND;
|
$new_relation = Contact::FRIEND;
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,30 +370,12 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
|
|
||||||
DBA::delete('intro', ['id' => $intro_id]);
|
DBA::delete('intro', ['id' => $intro_id]);
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `name-date` = '%s',
|
$fields = ['name-date' => DateTimeFormat::utcNow(),
|
||||||
`uri-date` = '%s',
|
'uri-date' => DateTimeFormat::utcNow(), 'addr' => $addr,
|
||||||
`addr` = '%s',
|
'notify' => $notify, 'poll' => $poll, 'blocked' => false,
|
||||||
`notify` = '%s',
|
'pending' => $pending, 'network' => $network,
|
||||||
`poll` = '%s',
|
'writable' => $writable, 'hidden' => $hidden, 'rel' => $new_relation];
|
||||||
`blocked` = 0,
|
DBA::update('contact', $fields, ['id' => $contact_id]);
|
||||||
`pending` = 0,
|
|
||||||
`network` = '%s',
|
|
||||||
`writable` = %d,
|
|
||||||
`hidden` = %d,
|
|
||||||
`rel` = %d
|
|
||||||
WHERE `id` = %d
|
|
||||||
",
|
|
||||||
DBA::escape(DateTimeFormat::utcNow()),
|
|
||||||
DBA::escape(DateTimeFormat::utcNow()),
|
|
||||||
DBA::escape($addr),
|
|
||||||
DBA::escape($notify),
|
|
||||||
DBA::escape($poll),
|
|
||||||
DBA::escape($network),
|
|
||||||
intval($writable),
|
|
||||||
intval($hidden),
|
|
||||||
intval($new_relation),
|
|
||||||
intval($contact_id)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
|
@ -403,10 +393,14 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
|
|
||||||
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
|
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
|
||||||
|
|
||||||
|
if ($network == Protocol::ACTIVITYPUB && $duplex) {
|
||||||
|
ActivityPub\Transmitter::sendActivity('Follow', $contact['url'], $uid);
|
||||||
|
}
|
||||||
|
|
||||||
// Let's send our user to the contact editor in case they want to
|
// Let's send our user to the contact editor in case they want to
|
||||||
// do anything special with this new friend.
|
// do anything special with this new friend.
|
||||||
if ($handsfree === null) {
|
if ($handsfree === null) {
|
||||||
goaway(System::baseUrl() . '/contacts/' . intval($contact_id));
|
goaway(System::baseUrl() . '/contact/' . intval($contact_id));
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -610,7 +604,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
'to_name' => $combined['username'],
|
'to_name' => $combined['username'],
|
||||||
'to_email' => $combined['email'],
|
'to_email' => $combined['email'],
|
||||||
'uid' => $combined['uid'],
|
'uid' => $combined['uid'],
|
||||||
'link' => System::baseUrl() . '/contacts/' . $dfrn_record,
|
'link' => System::baseUrl() . '/contact/' . $dfrn_record,
|
||||||
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
|
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
|
||||||
'source_link' => $combined['url'],
|
'source_link' => $combined['url'],
|
||||||
'source_photo' => $combined['photo'],
|
'source_photo' => $combined['photo'],
|
||||||
|
|
|
@ -79,13 +79,13 @@ function dfrn_notify_post(App $a) {
|
||||||
$condition = [];
|
$condition = [];
|
||||||
switch ($direction) {
|
switch ($direction) {
|
||||||
case (-1):
|
case (-1):
|
||||||
$condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
|
$condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true];
|
$condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
|
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
System::xmlExit(3, 'Invalid direction');
|
System::xmlExit(3, 'Invalid direction');
|
||||||
|
@ -182,7 +182,7 @@ function dfrn_notify_post(App $a) {
|
||||||
|
|
||||||
function dfrn_dispatch_public($postdata)
|
function dfrn_dispatch_public($postdata)
|
||||||
{
|
{
|
||||||
$msg = Diaspora::decodeRaw([], $postdata);
|
$msg = Diaspora::decodeRaw([], $postdata, true);
|
||||||
if (!$msg) {
|
if (!$msg) {
|
||||||
// We have to fail silently to be able to hand it over to the salmon parser
|
// We have to fail silently to be able to hand it over to the salmon parser
|
||||||
return false;
|
return false;
|
||||||
|
@ -287,15 +287,15 @@ function dfrn_notify_content(App $a) {
|
||||||
$condition = [];
|
$condition = [];
|
||||||
switch ($direction) {
|
switch ($direction) {
|
||||||
case (-1):
|
case (-1):
|
||||||
$condition = ["`issued-id` = ? OR `dfrn-id` = ?", $dfrn_id, $dfrn_id];
|
$condition = ["(`issued-id` = ? OR `dfrn-id` = ?) AND `uid` = ?", $dfrn_id, $dfrn_id, $user['uid']];
|
||||||
$my_id = $dfrn_id;
|
$my_id = $dfrn_id;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
$condition = ['issued-id' => $dfrn_id, 'duplex' => true];
|
$condition = ['issued-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||||
$my_id = '1:' . $dfrn_id;
|
$my_id = '1:' . $dfrn_id;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true];
|
$condition = ['dfrn-id' => $dfrn_id, 'duplex' => true, 'uid' => $user['uid']];
|
||||||
$my_id = '0:' . $dfrn_id;
|
$my_id = '0:' . $dfrn_id;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -322,8 +322,8 @@ function dfrn_notify_content(App $a) {
|
||||||
$encrypted_id = '';
|
$encrypted_id = '';
|
||||||
$id_str = $my_id . '.' . mt_rand(1000,9999);
|
$id_str = $my_id . '.' . mt_rand(1000,9999);
|
||||||
|
|
||||||
$prv_key = trim($importer['prvkey']);
|
$prv_key = trim($importer['cprvkey']);
|
||||||
$pub_key = trim($importer['pubkey']);
|
$pub_key = trim($importer['cpubkey']);
|
||||||
$dplx = intval($importer['duplex']);
|
$dplx = intval($importer['duplex']);
|
||||||
|
|
||||||
if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
|
if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
|
||||||
|
|
|
@ -502,7 +502,7 @@ function dfrn_poll_content(App $a)
|
||||||
'dfrn_version' => DFRN_PROTOCOL_VERSION,
|
'dfrn_version' => DFRN_PROTOCOL_VERSION,
|
||||||
'challenge' => $challenge,
|
'challenge' => $challenge,
|
||||||
'sec' => $sec
|
'sec' => $sec
|
||||||
]);
|
])->getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = ((DBA::isResult($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
|
$profile = ((DBA::isResult($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
|
||||||
|
|
|
@ -173,9 +173,9 @@ function dfrn_request_post(App $a)
|
||||||
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
|
Contact::updateAvatar($photo, local_user(), $r[0]["id"], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$forwardurl = System::baseUrl() . "/contacts/" . $r[0]['id'];
|
$forwardurl = System::baseUrl() . "/contact/" . $r[0]['id'];
|
||||||
} else {
|
} else {
|
||||||
$forwardurl = System::baseUrl() . "/contacts";
|
$forwardurl = System::baseUrl() . "/contact";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the blocked remote notification to complete
|
// Allow the blocked remote notification to complete
|
||||||
|
@ -451,10 +451,10 @@ function dfrn_request_post(App $a)
|
||||||
// Diaspora needs the uri in the format user@domain.tld
|
// Diaspora needs the uri in the format user@domain.tld
|
||||||
// Diaspora will support the remote subscription in a future version
|
// Diaspora will support the remote subscription in a future version
|
||||||
if ($network == Protocol::DIASPORA) {
|
if ($network == Protocol::DIASPORA) {
|
||||||
$uri = $nickname . '@' . $a->get_hostname();
|
$uri = $nickname . '@' . $a->getHostName();
|
||||||
|
|
||||||
if ($a->get_path()) {
|
if ($a->getURLPath()) {
|
||||||
$uri .= '/' . $a->get_path();
|
$uri .= '/' . $a->getURLPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = urlencode($uri);
|
$uri = urlencode($uri);
|
||||||
|
@ -609,7 +609,7 @@ function dfrn_request_content(App $a)
|
||||||
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
|
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
|
||||||
$myaddr = $_GET['address'];
|
$myaddr = $_GET['address'];
|
||||||
} elseif (local_user()) {
|
} elseif (local_user()) {
|
||||||
if (strlen($a->urlpath)) {
|
if (strlen($a->getURLPath())) {
|
||||||
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||||
} else {
|
} else {
|
||||||
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
|
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
|
||||||
|
|
|
@ -16,7 +16,7 @@ use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
|
||||||
function directory_init(App $a)
|
function directory_init(App $a)
|
||||||
{
|
{
|
||||||
$a->set_pager_itemspage(60);
|
$a->setPagerItemsPage(60);
|
||||||
|
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
$a->page['aside'] .= Widget::findPeople();
|
$a->page['aside'] .= Widget::findPeople();
|
||||||
|
@ -87,7 +87,7 @@ function directory_content(App $a)
|
||||||
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||||
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
|
WHERE `is-default` $publish AND NOT `user`.`blocked` AND NOT `user`.`account_removed` $sql_extra");
|
||||||
if (DBA::isResult($cnt)) {
|
if (DBA::isResult($cnt)) {
|
||||||
$a->set_pager_total($cnt['total']);
|
$a->setPagerTotal($cnt['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$order = " ORDER BY `name` ASC ";
|
$order = " ORDER BY `name` ASC ";
|
||||||
|
|
|
@ -12,14 +12,13 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model;
|
||||||
use Friendica\Model\GContact;
|
use Friendica\Module;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
|
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
function dirfind_init(App $a) {
|
function dirfind_init(App $a) {
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
$local = Config::get('system','poco_local_search');
|
$local = Config::get('system','poco_local_search');
|
||||||
|
|
||||||
$search = $prefix.notags(trim($_REQUEST['search']));
|
$search = $prefix.notags(trim(defaults($_REQUEST, 'search', '')));
|
||||||
|
|
||||||
$header = '';
|
$header = '';
|
||||||
|
|
||||||
|
@ -54,7 +53,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
if ((valid_email($search) && Network::isEmailDomainValid($search)) ||
|
if ((valid_email($search) && Network::isEmailDomainValid($search)) ||
|
||||||
(substr(normalise_link($search), 0, 7) == "http://")) {
|
(substr(normalise_link($search), 0, 7) == "http://")) {
|
||||||
$user_data = Probe::uri($search);
|
$user_data = Probe::uri($search);
|
||||||
$discover_user = (in_array($user_data["network"], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
$discover_user = (in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +82,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
$objresult->tags = "";
|
$objresult->tags = "";
|
||||||
$objresult->network = $user_data["network"];
|
$objresult->network = $user_data["network"];
|
||||||
|
|
||||||
$contact = Contact::getDetailsByURL($user_data["url"], local_user());
|
$contact = Model\Contact::getDetailsByURL($user_data["url"], local_user());
|
||||||
$objresult->cid = $contact["cid"];
|
$objresult->cid = $contact["cid"];
|
||||||
$objresult->pcid = $contact["zid"];
|
$objresult->pcid = $contact["zid"];
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
// 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) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
||||||
GContact::update($user_data);
|
Model\GContact::update($user_data);
|
||||||
}
|
}
|
||||||
} elseif ($local) {
|
} elseif ($local) {
|
||||||
|
|
||||||
|
@ -156,7 +155,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = Contact::getDetailsByURL($result["nurl"], local_user());
|
$result = Model\Contact::getDetailsByURL($result["nurl"], local_user());
|
||||||
|
|
||||||
if ($result["name"] == "") {
|
if ($result["name"] == "") {
|
||||||
$result["name"] = end(explode("/", $urlparts["path"]));
|
$result["name"] = end(explode("/", $urlparts["path"]));
|
||||||
|
@ -188,8 +187,8 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($j->total) {
|
if ($j->total) {
|
||||||
$a->set_pager_total($j->total);
|
$a->setPagerTotal($j->total);
|
||||||
$a->set_pager_itemspage($j->items_page);
|
$a->setPagerItemsPage($j->items_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($j->results)) {
|
if (!empty($j->results)) {
|
||||||
|
@ -200,7 +199,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
$alt_text = "";
|
$alt_text = "";
|
||||||
|
|
||||||
$contact_details = Contact::getDetailsByURL($jj->url, local_user());
|
$contact_details = Model\Contact::getDetailsByURL($jj->url, local_user());
|
||||||
|
|
||||||
$itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
|
$itemurl = (($contact_details["addr"] != "") ? $contact_details["addr"] : $jj->url);
|
||||||
|
|
||||||
|
@ -210,8 +209,8 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
$conntxt = "";
|
$conntxt = "";
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $jj->cid]);
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$photo_menu = Contact::photoMenu($contact);
|
$photo_menu = Model\Contact::photoMenu($contact);
|
||||||
$details = _contact_detail_for_template($contact);
|
$details = Module\Contact::getContactTemplateVars($contact);
|
||||||
$alt_text = $details['alt_text'];
|
$alt_text = $details['alt_text'];
|
||||||
} else {
|
} else {
|
||||||
$photo_menu = [];
|
$photo_menu = [];
|
||||||
|
@ -222,12 +221,12 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $jj->pcid]);
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$photo_menu = Contact::photoMenu($contact);
|
$photo_menu = Model\Contact::photoMenu($contact);
|
||||||
} else {
|
} else {
|
||||||
$photo_menu = [];
|
$photo_menu = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$photo_menu['profile'] = [L10n::t("View Profile"), Contact::magicLink($jj->url)];
|
$photo_menu['profile'] = [L10n::t("View Profile"), Model\Contact::magicLink($jj->url)];
|
||||||
$photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
|
$photo_menu['follow'] = [L10n::t("Connect/Follow"), $connlnk];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +234,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
|
|
||||||
$entry = [
|
$entry = [
|
||||||
'alt_text' => $alt_text,
|
'alt_text' => $alt_text,
|
||||||
'url' => Contact::magicLink($jj->url),
|
'url' => Model\Contact::magicLink($jj->url),
|
||||||
'itemurl' => $itemurl,
|
'itemurl' => $itemurl,
|
||||||
'name' => htmlentities($jj->name),
|
'name' => htmlentities($jj->name),
|
||||||
'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
|
'thumb' => ProxyUtils::proxifyUrl($jj->photo, false, ProxyUtils::SIZE_THUMB),
|
||||||
|
@ -246,7 +245,7 @@ function dirfind_content(App $a, $prefix = "") {
|
||||||
'details' => $contact_details['location'],
|
'details' => $contact_details['location'],
|
||||||
'tags' => $contact_details['keywords'],
|
'tags' => $contact_details['keywords'],
|
||||||
'about' => $contact_details['about'],
|
'about' => $contact_details['about'],
|
||||||
'account_type' => Contact::getAccountType($contact_details),
|
'account_type' => Model\Contact::getAccountType($contact_details),
|
||||||
'network' => ContactSelector::networkToName($jj->network, $jj->url),
|
'network' => ContactSelector::networkToName($jj->network, $jj->url),
|
||||||
'id' => ++$id,
|
'id' => ++$id,
|
||||||
];
|
];
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Model\Group;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
|
use Friendica\Protocol\ActivityPub;
|
||||||
|
|
||||||
function display_init(App $a)
|
function display_init(App $a)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +44,7 @@ function display_init(App $a)
|
||||||
|
|
||||||
$item = null;
|
$item = null;
|
||||||
|
|
||||||
$fields = ['id', 'parent', 'author-id', 'body', 'uid'];
|
$fields = ['id', 'parent', 'author-id', 'body', 'uid', 'guid'];
|
||||||
|
|
||||||
// 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) {
|
||||||
|
@ -76,6 +77,10 @@ function display_init(App $a)
|
||||||
displayShowFeed($item["id"], false);
|
displayShowFeed($item["id"], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ActivityPub::isRequest()) {
|
||||||
|
goaway(str_replace('display/', 'objects/', $a->query_string));
|
||||||
|
}
|
||||||
|
|
||||||
if ($item["id"] != $item["parent"]) {
|
if ($item["id"] != $item["parent"]) {
|
||||||
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $item["parent"]]);
|
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $item["parent"]]);
|
||||||
}
|
}
|
||||||
|
@ -360,7 +365,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
|
||||||
$title = trim(HTML::toPlaintext(BBCode::convert($item["title"], false), 0, true));
|
$title = trim(HTML::toPlaintext(BBCode::convert($item["title"], false), 0, true));
|
||||||
$author_name = $item["author-name"];
|
$author_name = $item["author-name"];
|
||||||
|
|
||||||
$image = $a->remove_baseurl($item["author-avatar"]);
|
$image = $a->removeBaseURL($item["author-avatar"]);
|
||||||
|
|
||||||
if ($title == "") {
|
if ($title == "") {
|
||||||
$title = $author_name;
|
$title = $author_name;
|
||||||
|
|
|
@ -28,7 +28,7 @@ function editpost_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
$fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||||
'type', 'body', 'title', 'file', 'wall', 'post-type'];
|
'type', 'body', 'title', 'file', 'wall', 'post-type', 'guid'];
|
||||||
|
|
||||||
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
|
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
|
||||||
|
|
||||||
|
@ -51,15 +51,6 @@ function editpost_content(App $a)
|
||||||
'$nickname' => $a->user['nickname']
|
'$nickname' => $a->user['nickname']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('jot-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$baseurl' => System::baseUrl(),
|
|
||||||
'$ispublic' => ' ', // L10n::t('Visible to <strong>everybody</strong>'),
|
|
||||||
'$geotag' => $geotag,
|
|
||||||
'$nickname' => $a->user['nickname']
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
|
||||||
$tpl = get_markup_template("jot.tpl");
|
$tpl = get_markup_template("jot.tpl");
|
||||||
|
|
||||||
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
|
if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
|
||||||
|
@ -95,7 +86,7 @@ function editpost_content(App $a)
|
||||||
|
|
||||||
$o .= replace_macros($tpl, [
|
$o .= replace_macros($tpl, [
|
||||||
'$is_edit' => true,
|
'$is_edit' => true,
|
||||||
'$return_path' => $_SESSION['return_url'],
|
'$return_path' => '/display/' . $item['guid'],
|
||||||
'$action' => 'item',
|
'$action' => 'item',
|
||||||
'$share' => L10n::t('Save'),
|
'$share' => L10n::t('Save'),
|
||||||
'$upload' => L10n::t('Upload photo'),
|
'$upload' => L10n::t('Upload photo'),
|
||||||
|
|
150
mod/events.php
150
mod/events.php
|
@ -17,10 +17,12 @@ use Friendica\Model\Item;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
function events_init(App $a) {
|
function events_init(App $a)
|
||||||
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +44,8 @@ function events_init(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function events_post(App $a) {
|
function events_post(App $a)
|
||||||
|
{
|
||||||
|
|
||||||
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||||
|
|
||||||
|
@ -50,15 +53,15 @@ function events_post(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event_id = (x($_POST, 'event_id') ? intval($_POST['event_id']) : 0);
|
$event_id = !empty($_POST['event_id']) ? intval($_POST['event_id']) : 0;
|
||||||
$cid = (x($_POST, 'cid') ? intval($_POST['cid']) : 0);
|
$cid = !empty($_POST['cid']) ? intval($_POST['cid']) : 0;
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
|
|
||||||
$start_text = escape_tags($_REQUEST['start_text']);
|
$start_text = escape_tags(defaults($_REQUEST, 'start_text', ''));
|
||||||
$finish_text = escape_tags($_REQUEST['finish_text']);
|
$finish_text = escape_tags(defaults($_REQUEST, 'finish_text', ''));
|
||||||
|
|
||||||
$adjust = intval($_POST['adjust']);
|
$adjust = intval(defaults($_POST, 'adjust', 0));
|
||||||
$nofinish = intval($_POST['nofinish']);
|
$nofinish = intval(defaults($_POST, 'nofinish', 0));
|
||||||
|
|
||||||
// The default setting for the `private` field in event_store() is false, so mirror that
|
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||||
$private_event = false;
|
$private_event = false;
|
||||||
|
@ -91,9 +94,9 @@ function events_post(App $a) {
|
||||||
// and we'll waste a bunch of time responding to it. Time that
|
// and we'll waste a bunch of time responding to it. Time that
|
||||||
// could've been spent doing something else.
|
// could've been spent doing something else.
|
||||||
|
|
||||||
$summary = escape_tags(trim($_POST['summary']));
|
$summary = escape_tags(trim(defaults($_POST, 'summary', '')));
|
||||||
$desc = escape_tags(trim($_POST['desc']));
|
$desc = escape_tags(trim(defaults($_POST, 'desc', '')));
|
||||||
$location = escape_tags(trim($_POST['location']));
|
$location = escape_tags(trim(defaults($_POST, 'location', '')));
|
||||||
$type = 'event';
|
$type = 'event';
|
||||||
|
|
||||||
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
|
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
|
||||||
|
@ -117,7 +120,7 @@ function events_post(App $a) {
|
||||||
goaway($onerror_url);
|
goaway($onerror_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
$share = (intval($_POST['share']) ? intval($_POST['share']) : 0);
|
$share = intval(defaults($_POST, 'share', 0));
|
||||||
|
|
||||||
$c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
$c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -137,7 +140,7 @@ function events_post(App $a) {
|
||||||
$str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
|
$str_contact_deny = !empty($_POST['contact_deny']) ? perms2str($_POST['contact_deny']) : '';
|
||||||
|
|
||||||
// Undo the pseudo-contact of self, since there are real contacts now
|
// Undo the pseudo-contact of self, since there are real contacts now
|
||||||
if (strpos($str_contact_allow, '<' . $self . '>') !== false ) {
|
if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
|
||||||
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
|
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
|
||||||
}
|
}
|
||||||
// Make sure to set the `private` field as true. This is necessary to
|
// Make sure to set the `private` field as true. This is necessary to
|
||||||
|
@ -184,14 +187,14 @@ function events_post(App $a) {
|
||||||
Worker::add(PRIORITY_HIGH, "Notifier", "event", $item_id);
|
Worker::add(PRIORITY_HIGH, "Notifier", "event", $item_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
goaway($_SESSION['return_url']);
|
goaway('/events');
|
||||||
}
|
}
|
||||||
|
|
||||||
function events_content(App $a) {
|
function events_content(App $a)
|
||||||
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc == 1) {
|
if ($a->argc == 1) {
|
||||||
|
@ -229,11 +232,6 @@ function events_content(App $a) {
|
||||||
'$i18n' => $i18n,
|
'$i18n' => $i18n,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$etpl = get_markup_template('event_end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($etpl, [
|
|
||||||
'$baseurl' => System::baseUrl(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
$tabs = '';
|
$tabs = '';
|
||||||
// tabs
|
// tabs
|
||||||
|
@ -244,7 +242,7 @@ function events_content(App $a) {
|
||||||
$mode = 'view';
|
$mode = 'view';
|
||||||
$y = 0;
|
$y = 0;
|
||||||
$m = 0;
|
$m = 0;
|
||||||
$ignored = (x($_REQUEST, 'ignored') ? intval($_REQUEST['ignored']) : 0);
|
$ignored = !empty($_REQUEST['ignored']) ? intval($_REQUEST['ignored']) : 0;
|
||||||
|
|
||||||
if ($a->argc > 1) {
|
if ($a->argc > 1) {
|
||||||
if ($a->argc > 2 && $a->argv[1] == 'event') {
|
if ($a->argc > 2 && $a->argv[1] == 'event') {
|
||||||
|
@ -272,7 +270,6 @@ function events_content(App $a) {
|
||||||
|
|
||||||
// The view mode part is similiar to /mod/cal.php
|
// The view mode part is similiar to /mod/cal.php
|
||||||
if ($mode == 'view') {
|
if ($mode == 'view') {
|
||||||
|
|
||||||
$thisyear = DateTimeFormat::localNow('Y');
|
$thisyear = DateTimeFormat::localNow('Y');
|
||||||
$thismonth = DateTimeFormat::localNow('m');
|
$thismonth = DateTimeFormat::localNow('m');
|
||||||
if (!$y) {
|
if (!$y) {
|
||||||
|
@ -312,10 +309,10 @@ function events_content(App $a) {
|
||||||
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
|
||||||
|
|
||||||
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
||||||
if (x($_GET, 'start')) {
|
if (!empty($_GET['start'])) {
|
||||||
$start = $_GET['start'];
|
$start = $_GET['start'];
|
||||||
}
|
}
|
||||||
if (x($_GET, 'end')) {
|
if (!empty($_GET['end'])) {
|
||||||
$finish = $_GET['end'];
|
$finish = $_GET['end'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +346,7 @@ function events_content(App $a) {
|
||||||
$r = Event::sortByDate($r);
|
$r = Event::sortByDate($r);
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
|
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
|
||||||
if (!x($links,$j)) {
|
if (empty($links[$j])) {
|
||||||
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,12 +360,12 @@ function events_content(App $a) {
|
||||||
$events = Event::prepareListForTemplate($r);
|
$events = Event::prepareListForTemplate($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc > 1 && $a->argv[1] === 'json'){
|
if ($a->argc > 1 && $a->argv[1] === 'json') {
|
||||||
echo json_encode($events);
|
echo json_encode($events);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_GET, 'id')) {
|
if (!empty($_GET['id'])) {
|
||||||
$tpl = get_markup_template("event.tpl");
|
$tpl = get_markup_template("event.tpl");
|
||||||
} else {
|
} else {
|
||||||
$tpl = get_markup_template("events_js.tpl");
|
$tpl = get_markup_template("events_js.tpl");
|
||||||
|
@ -378,7 +375,7 @@ function events_content(App $a) {
|
||||||
foreach ($events as $key => $event) {
|
foreach ($events as $key => $event) {
|
||||||
$event_item = [];
|
$event_item = [];
|
||||||
foreach ($event['item'] as $k => $v) {
|
foreach ($event['item'] as $k => $v) {
|
||||||
$k = str_replace('-' ,'_', $k);
|
$k = str_replace('-', '_', $k);
|
||||||
$event_item[$k] = $v;
|
$event_item[$k] = $v;
|
||||||
}
|
}
|
||||||
$events[$key]['item'] = $event_item;
|
$events[$key]['item'] = $event_item;
|
||||||
|
@ -403,7 +400,7 @@ function events_content(App $a) {
|
||||||
'$list' => L10n::t('list'),
|
'$list' => L10n::t('list'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (x($_GET, 'id')) {
|
if (!empty($_GET['id'])) {
|
||||||
echo $o;
|
echo $o;
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
@ -428,41 +425,45 @@ function events_content(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
|
||||||
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
if (!empty($_REQUEST['nofinish'])) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||||
if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
if (!empty($_REQUEST['adjust'])) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
||||||
if (x($_REQUEST, 'summary')) {$orig_event['summary'] = $_REQUEST['summary'];}
|
if (!empty($_REQUEST['summary'])) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||||
if (x($_REQUEST, 'description')) {$orig_event['description'] = $_REQUEST['description'];}
|
if (!empty($_REQUEST['description'])) {$orig_event['description'] = $_REQUEST['description'];}
|
||||||
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
if (!empty($_REQUEST['location'])) {$orig_event['location'] = $_REQUEST['location'];}
|
||||||
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
if (!empty($_REQUEST['start'])) {$orig_event['start'] = $_REQUEST['start'];}
|
||||||
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
if (!empty($_REQUEST['finish'])) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||||
if (x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
|
|
||||||
|
|
||||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
$n_checked = (!empty($orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
$a_checked = (!empty($orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||||
|
|
||||||
$t_orig = (x($orig_event) ? $orig_event['summary'] : '');
|
$t_orig = !empty($orig_event) ? $orig_event['summary'] : '';
|
||||||
$d_orig = (x($orig_event) ? $orig_event['desc'] : '');
|
$d_orig = !empty($orig_event) ? $orig_event['desc'] : '';
|
||||||
$l_orig = (x($orig_event) ? $orig_event['location'] : '');
|
$l_orig = !empty($orig_event) ? $orig_event['location'] : '';
|
||||||
$eid = (x($orig_event) ? $orig_event['id'] : 0);
|
$eid = !empty($orig_event) ? $orig_event['id'] : 0;
|
||||||
$cid = (x($orig_event) ? $orig_event['cid'] : 0);
|
$cid = !empty($orig_event) ? $orig_event['cid'] : 0;
|
||||||
$uri = (x($orig_event) ? $orig_event['uri'] : '');
|
$uri = !empty($orig_event) ? $orig_event['uri'] : '';
|
||||||
|
|
||||||
$sh_disabled = '';
|
$sh_disabled = '';
|
||||||
$sh_checked = '';
|
$sh_checked = '';
|
||||||
|
|
||||||
if (x($orig_event)) {
|
if (!empty($orig_event)
|
||||||
$sh_checked = (($orig_event['allow_cid'] === '<' . local_user() . '>' && !$orig_event['allow_gid'] && !$orig_event['deny_cid'] && !$orig_event['deny_gid']) ? '' : ' checked="checked" ');
|
&& ($orig_event['allow_cid'] !== '<' . local_user() . '>'
|
||||||
|
|| $orig_event['allow_gid']
|
||||||
|
|| $orig_event['deny_cid']
|
||||||
|
|| $orig_event['deny_gid']))
|
||||||
|
{
|
||||||
|
$sh_checked = ' checked="checked" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid || $mode === 'edit') {
|
if ($cid || $mode === 'edit') {
|
||||||
$sh_disabled = 'disabled="disabled"';
|
$sh_disabled = 'disabled="disabled"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sdt = (x($orig_event) ? $orig_event['start'] : 'now');
|
$sdt = !empty($orig_event) ? $orig_event['start'] : 'now';
|
||||||
$fdt = (x($orig_event) ? $orig_event['finish'] : 'now');
|
$fdt = !empty($orig_event) ? $orig_event['finish'] : 'now';
|
||||||
|
|
||||||
$tz = date_default_timezone_get();
|
$tz = date_default_timezone_get();
|
||||||
if (x($orig_event)) {
|
if (!empty($orig_event)) {
|
||||||
$tz = ($orig_event['adjust'] ? date_default_timezone_get() : 'UTC');
|
$tz = ($orig_event['adjust'] ? date_default_timezone_get() : 'UTC');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,20 +471,22 @@ function events_content(App $a) {
|
||||||
$smonth = DateTimeFormat::convert($sdt, $tz, 'UTC', 'm');
|
$smonth = DateTimeFormat::convert($sdt, $tz, 'UTC', 'm');
|
||||||
$sday = DateTimeFormat::convert($sdt, $tz, 'UTC', 'd');
|
$sday = DateTimeFormat::convert($sdt, $tz, 'UTC', 'd');
|
||||||
|
|
||||||
$shour = (x($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'H') : '00');
|
$shour = !empty($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'H') : '00';
|
||||||
$sminute = (x($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'i') : '00');
|
$sminute = !empty($orig_event) ? DateTimeFormat::convert($sdt, $tz, 'UTC', 'i') : '00';
|
||||||
|
|
||||||
$fyear = DateTimeFormat::convert($fdt, $tz, 'UTC', 'Y');
|
$fyear = DateTimeFormat::convert($fdt, $tz, 'UTC', 'Y');
|
||||||
$fmonth = DateTimeFormat::convert($fdt, $tz, 'UTC', 'm');
|
$fmonth = DateTimeFormat::convert($fdt, $tz, 'UTC', 'm');
|
||||||
$fday = DateTimeFormat::convert($fdt, $tz, 'UTC', 'd');
|
$fday = DateTimeFormat::convert($fdt, $tz, 'UTC', 'd');
|
||||||
|
|
||||||
$fhour = (x($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00');
|
$fhour = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'H') : '00';
|
||||||
$fminute = (x($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00');
|
$fminute = !empty($orig_event) ? DateTimeFormat::convert($fdt, $tz, 'UTC', 'i') : '00';
|
||||||
|
|
||||||
$perms = ACL::getDefaultUserPermissions($orig_event);
|
$perms = ACL::getDefaultUserPermissions($orig_event);
|
||||||
|
|
||||||
if ($mode === 'new' || $mode === 'copy') {
|
if (!$cid && in_array($mode, ['new', 'copy'])) {
|
||||||
$acl = ($cid ? '' : ACL::getFullSelectorHTML($a->user, false, $orig_event));
|
$acl = ACL::getFullSelectorHTML($a->user, false, $orig_event);
|
||||||
|
} else {
|
||||||
|
$acl = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we copy an old event, we need to remove the ID and URI
|
// If we copy an old event, we need to remove the ID and URI
|
||||||
|
@ -495,7 +498,7 @@ function events_content(App $a) {
|
||||||
|
|
||||||
$tpl = get_markup_template('event_form.tpl');
|
$tpl = get_markup_template('event_form.tpl');
|
||||||
|
|
||||||
$o .= replace_macros($tpl,[
|
$o .= replace_macros($tpl, [
|
||||||
'$post' => System::baseUrl() . '/events',
|
'$post' => System::baseUrl() . '/events',
|
||||||
'$eid' => $eid,
|
'$eid' => $eid,
|
||||||
'$cid' => $cid,
|
'$cid' => $cid,
|
||||||
|
@ -509,11 +512,31 @@ function events_content(App $a) {
|
||||||
'$title' => L10n::t('Event details'),
|
'$title' => L10n::t('Event details'),
|
||||||
'$desc' => L10n::t('Starting date and Title are required.'),
|
'$desc' => L10n::t('Starting date and Title are required.'),
|
||||||
'$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
|
'$s_text' => L10n::t('Event Starts:') . ' <span class="required" title="' . L10n::t('Required') . '">*</span>',
|
||||||
'$s_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $syear+5), DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"), L10n::t('Event Starts:'), 'start_text', true, true, '', '', true),
|
'$s_dsel' => Temporal::getDateTimeField(
|
||||||
|
new DateTime(),
|
||||||
|
DateTime::createFromFormat('Y', $syear+5),
|
||||||
|
DateTime::createFromFormat('Y-m-d H:i', "$syear-$smonth-$sday $shour:$sminute"),
|
||||||
|
L10n::t('Event Starts:'),
|
||||||
|
'start_text',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
),
|
||||||
'$n_text' => L10n::t('Finish date/time is not known or not relevant'),
|
'$n_text' => L10n::t('Finish date/time is not known or not relevant'),
|
||||||
'$n_checked' => $n_checked,
|
'$n_checked' => $n_checked,
|
||||||
'$f_text' => L10n::t('Event Finishes:'),
|
'$f_text' => L10n::t('Event Finishes:'),
|
||||||
'$f_dsel' => Temporal::getDateTimeField(new DateTime(), DateTime::createFromFormat('Y', $fyear+5), DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"), L10n::t('Event Finishes:'), 'finish_text', true, true, 'start_text'),
|
'$f_dsel' => Temporal::getDateTimeField(
|
||||||
|
new DateTime(),
|
||||||
|
DateTime::createFromFormat('Y', $fyear+5),
|
||||||
|
DateTime::createFromFormat('Y-m-d H:i', "$fyear-$fmonth-$fday $fhour:$fminute"),
|
||||||
|
L10n::t('Event Finishes:'),
|
||||||
|
'finish_text',
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
'start_text'
|
||||||
|
),
|
||||||
'$a_text' => L10n::t('Adjust for viewer timezone'),
|
'$a_text' => L10n::t('Adjust for viewer timezone'),
|
||||||
'$a_checked' => $a_checked,
|
'$a_checked' => $a_checked,
|
||||||
'$d_text' => L10n::t('Description:'),
|
'$d_text' => L10n::t('Description:'),
|
||||||
|
@ -534,7 +557,6 @@ function events_content(App $a) {
|
||||||
'$basic' => L10n::t('Basic'),
|
'$basic' => L10n::t('Basic'),
|
||||||
'$advanced' => L10n::t('Advanced'),
|
'$advanced' => L10n::t('Advanced'),
|
||||||
'$permissions' => L10n::t('Permissions'),
|
'$permissions' => L10n::t('Permissions'),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
|
@ -32,8 +32,7 @@ function feedtest_content(App $a)
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||||
|
|
||||||
$ret = Network::curl($contact['poll']);
|
$xml = Network::fetchUrl($contact['poll']);
|
||||||
$xml = $ret['body'];
|
|
||||||
|
|
||||||
$dummy = null;
|
$dummy = null;
|
||||||
$import_result = Feed::import($xml, $importer, $contact, $dummy, true);
|
$import_result = Feed::import($xml, $importer, $contact, $dummy, true);
|
||||||
|
|
|
@ -25,7 +25,7 @@ function fetch_init(App $a)
|
||||||
|
|
||||||
// Fetch the item
|
// Fetch the item
|
||||||
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network',
|
$fields = ['uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'app', 'location', 'coord', 'network',
|
||||||
'event-id', 'resource-id', 'author-link', 'owner-link', 'attach'];
|
'event-id', 'resource-id', 'author-link', 'author-avatar', 'author-name', 'plink', 'owner-link', 'attach'];
|
||||||
$condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
$condition = ['wall' => true, 'private' => false, 'guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
|
||||||
$item = Item::selectFirst($fields, $condition);
|
$item = Item::selectFirst($fields, $condition);
|
||||||
if (!DBA::isResult($item)) {
|
if (!DBA::isResult($item)) {
|
||||||
|
|
|
@ -25,9 +25,7 @@ function filerm_content(App $a) {
|
||||||
file_tag_unsave_file(local_user(),$item_id,$term, $category);
|
file_tag_unsave_file(local_user(),$item_id,$term, $category);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_SESSION,'return_url')) {
|
//goaway('/network');
|
||||||
goaway(System::baseUrl() . '/' . $_SESSION['return_url']);
|
|
||||||
}
|
|
||||||
|
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ function follow_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['cancel'])) {
|
if (isset($_REQUEST['cancel'])) {
|
||||||
goaway($_SESSION['return_url']);
|
goaway('contacts');
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$url = notags(trim($_REQUEST['url']));
|
$url = notags(trim($_REQUEST['url']));
|
||||||
$return_url = $_SESSION['return_url'];
|
$return_url = 'contacts';
|
||||||
|
|
||||||
// Makes the connection request for friendica contacts easier
|
// Makes the connection request for friendica contacts easier
|
||||||
// This is just a precaution if maybe this page is called somewhere directly via POST
|
// This is just a precaution if maybe this page is called somewhere directly via POST
|
||||||
|
@ -39,7 +39,7 @@ function follow_post(App $a)
|
||||||
}
|
}
|
||||||
goaway($return_url);
|
goaway($return_url);
|
||||||
} elseif ($result['cid']) {
|
} elseif ($result['cid']) {
|
||||||
goaway(System::baseUrl() . '/contacts/' . $result['cid']);
|
goaway('contact/' . $result['cid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
info(L10n::t('The contact could not be added.'));
|
info(L10n::t('The contact could not be added.'));
|
||||||
|
@ -50,9 +50,11 @@ function follow_post(App $a)
|
||||||
|
|
||||||
function follow_content(App $a)
|
function follow_content(App $a)
|
||||||
{
|
{
|
||||||
|
$return_url = 'contacts';
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.'));
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($return_url);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +118,7 @@ function follow_content(App $a)
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
notice(L10n::t('Permission denied.'));
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($return_url);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ function fsuggest_post(App $a)
|
||||||
|
|
||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
|
|
||||||
$note = escape_tags(trim($_POST['note']));
|
$note = escape_tags(trim(defaults($_POST, 'note', '')));
|
||||||
|
|
||||||
if ($new_contact) {
|
if ($new_contact) {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
|
|
|
@ -11,12 +11,12 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model;
|
||||||
use Friendica\Model\Group;
|
use Friendica\Module;
|
||||||
|
|
||||||
function group_init(App $a) {
|
function group_init(App $a) {
|
||||||
if (local_user()) {
|
if (local_user()) {
|
||||||
$a->page['aside'] = Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
|
$a->page['aside'] = Model\Group::sidebarWidget('contacts', 'group', 'extended', (($a->argc > 1) ? $a->argv[1] : 'everyone'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +31,10 @@ function group_post(App $a) {
|
||||||
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
check_form_security_token_redirectOnErr('/group/new', 'group_edit');
|
||||||
|
|
||||||
$name = notags(trim($_POST['groupname']));
|
$name = notags(trim($_POST['groupname']));
|
||||||
$r = Group::create(local_user(), $name);
|
$r = Model\Group::create(local_user(), $name);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
info(L10n::t('Group created.') . EOL);
|
info(L10n::t('Group created.') . EOL);
|
||||||
$r = Group::getIdByName(local_user(), $name);
|
$r = Model\Group::getIdByName(local_user(), $name);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
goaway(System::baseUrl() . '/group/' . $r);
|
goaway(System::baseUrl() . '/group/' . $r);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ function group_post(App $a) {
|
||||||
);
|
);
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
notice(L10n::t('Group not found.') . EOL);
|
notice(L10n::t('Group not found.') . EOL);
|
||||||
goaway(System::baseUrl() . '/contacts');
|
goaway(System::baseUrl() . '/contact');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
$group = $r[0];
|
$group = $r[0];
|
||||||
|
@ -71,7 +71,7 @@ function group_post(App $a) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->page['aside'] = Group::sidebarWidget();
|
$a->page['aside'] = Model\Group::sidebarWidget();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -116,8 +116,6 @@ function group_content(App $a) {
|
||||||
$nogroup = false;
|
$nogroup = false;
|
||||||
|
|
||||||
if (($a->argc == 2) && ($a->argv[1] === 'none')) {
|
if (($a->argc == 2) && ($a->argv[1] === 'none')) {
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
$id = -1;
|
$id = -1;
|
||||||
$nogroup = true;
|
$nogroup = true;
|
||||||
$group = [
|
$group = [
|
||||||
|
@ -150,7 +148,7 @@ function group_content(App $a) {
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$result = Group::removeByName(local_user(), $r[0]['name']);
|
$result = Model\Group::removeByName(local_user(), $r[0]['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -176,8 +174,6 @@ function group_content(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($a->argc > 1) && intval($a->argv[1])) {
|
if (($a->argc > 1) && intval($a->argv[1])) {
|
||||||
require_once 'mod/contacts.php';
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
|
$r = q("SELECT * FROM `group` WHERE `id` = %d AND `uid` = %d AND `deleted` = 0 LIMIT 1",
|
||||||
intval($a->argv[1]),
|
intval($a->argv[1]),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -185,11 +181,11 @@ function group_content(App $a) {
|
||||||
|
|
||||||
if (!DBA::isResult($r)) {
|
if (!DBA::isResult($r)) {
|
||||||
notice(L10n::t('Group not found.') . EOL);
|
notice(L10n::t('Group not found.') . EOL);
|
||||||
goaway(System::baseUrl() . '/contacts');
|
goaway(System::baseUrl() . '/contact');
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = $r[0];
|
$group = $r[0];
|
||||||
$members = Contact::getByGroupId($group['id']);
|
$members = Model\Contact::getByGroupId($group['id']);
|
||||||
$preselected = [];
|
$preselected = [];
|
||||||
$entry = [];
|
$entry = [];
|
||||||
$id = 0;
|
$id = 0;
|
||||||
|
@ -202,12 +198,12 @@ function group_content(App $a) {
|
||||||
|
|
||||||
if ($change) {
|
if ($change) {
|
||||||
if (in_array($change, $preselected)) {
|
if (in_array($change, $preselected)) {
|
||||||
Group::removeMember($group['id'], $change);
|
Model\Group::removeMember($group['id'], $change);
|
||||||
} else {
|
} else {
|
||||||
Group::addMember($group['id'], $change);
|
Model\Group::addMember($group['id'], $change);
|
||||||
}
|
}
|
||||||
|
|
||||||
$members = Contact::getByGroupId($group['id']);
|
$members = Model\Contact::getByGroupId($group['id']);
|
||||||
$preselected = [];
|
$preselected = [];
|
||||||
if (count($members)) {
|
if (count($members)) {
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
|
@ -253,7 +249,7 @@ function group_content(App $a) {
|
||||||
// Format the data of the group members
|
// Format the data of the group members
|
||||||
foreach ($members as $member) {
|
foreach ($members as $member) {
|
||||||
if ($member['url']) {
|
if ($member['url']) {
|
||||||
$entry = _contact_detail_for_template($member);
|
$entry = Module\Contact::getContactTemplateVars($member);
|
||||||
$entry['label'] = 'members';
|
$entry['label'] = 'members';
|
||||||
$entry['photo_menu'] = '';
|
$entry['photo_menu'] = '';
|
||||||
$entry['change_member'] = [
|
$entry['change_member'] = [
|
||||||
|
@ -265,12 +261,12 @@ function group_content(App $a) {
|
||||||
|
|
||||||
$groupeditor['members'][] = $entry;
|
$groupeditor['members'][] = $entry;
|
||||||
} else {
|
} else {
|
||||||
Group::removeMember($group['id'], $member['id']);
|
Model\Group::removeMember($group['id'], $member['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nogroup) {
|
if ($nogroup) {
|
||||||
$r = Contact::getUngroupedList(local_user());
|
$r = Model\Contact::getUngroupedList(local_user());
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `self` ORDER BY `name` ASC",
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
|
@ -282,7 +278,7 @@ function group_content(App $a) {
|
||||||
// Format the data of the contacts who aren't in the contact group
|
// Format the data of the contacts who aren't in the contact group
|
||||||
foreach ($r as $member) {
|
foreach ($r as $member) {
|
||||||
if (!in_array($member['id'], $preselected)) {
|
if (!in_array($member['id'], $preselected)) {
|
||||||
$entry = _contact_detail_for_template($member);
|
$entry = Module\Contact::getContactTemplateVars($member);
|
||||||
$entry['label'] = 'contacts';
|
$entry['label'] = 'contacts';
|
||||||
if (!$nogroup)
|
if (!$nogroup)
|
||||||
$entry['photo_menu'] = [];
|
$entry['photo_menu'] = [];
|
||||||
|
|
|
@ -50,7 +50,7 @@ function hcard_init(App $a)
|
||||||
|
|
||||||
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
||||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->urlpath) ? '/' . $a->urlpath : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : ''));
|
||||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,12 @@ function help_content(App $a)
|
||||||
$path = '';
|
$path = '';
|
||||||
// looping through the argv keys bigger than 0 to build
|
// looping through the argv keys bigger than 0 to build
|
||||||
// a path relative to /help
|
// a path relative to /help
|
||||||
for ($x = 1; $x < argc(); $x ++) {
|
for ($x = 1; $x < $a->argc; $x ++) {
|
||||||
if (strlen($path)) {
|
if (strlen($path)) {
|
||||||
$path .= '/';
|
$path .= '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
$path .= argv($x);
|
$path .= $a->getArgumentValue($x);
|
||||||
}
|
}
|
||||||
$title = basename($path);
|
$title = basename($path);
|
||||||
$filename = $path;
|
$filename = $path;
|
||||||
|
|
|
@ -38,8 +38,8 @@ function home_content(App $a) {
|
||||||
$customhome = false;
|
$customhome = false;
|
||||||
$defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
|
$defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
|
||||||
|
|
||||||
$homefilepath = $a->basepath . "/home.html";
|
$homefilepath = $a->getBasePath() . "/home.html";
|
||||||
$cssfilepath = $a->basepath . "/home.css";
|
$cssfilepath = $a->getBasePath() . "/home.css";
|
||||||
if (file_exists($homefilepath)) {
|
if (file_exists($homefilepath)) {
|
||||||
$customhome = $homefilepath;
|
$customhome = $homefilepath;
|
||||||
if (file_exists($cssfilepath)) {
|
if (file_exists($cssfilepath)) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ function hostxrd_init(App $a)
|
||||||
|
|
||||||
$tpl = get_markup_template('xrd_host.tpl');
|
$tpl = get_markup_template('xrd_host.tpl');
|
||||||
echo replace_macros($tpl, [
|
echo replace_macros($tpl, [
|
||||||
'$zhost' => $a->get_hostname(),
|
'$zhost' => $a->getHostName(),
|
||||||
'$zroot' => System::baseUrl(),
|
'$zroot' => System::baseUrl(),
|
||||||
'$domain' => System::baseUrl(),
|
'$domain' => System::baseUrl(),
|
||||||
'$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))]
|
'$bigkey' => Salmon::salmonKey(Config::get('system', 'site_pubkey'))]
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Core\Install;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Database\DBStructure;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
|
||||||
$install_wizard_pass = 1;
|
$install_wizard_pass = 1;
|
||||||
|
@ -42,7 +43,6 @@ function install_post(App $a) {
|
||||||
return;
|
return;
|
||||||
break; // just in case return don't return :)
|
break; // just in case return don't return :)
|
||||||
case 3:
|
case 3:
|
||||||
$urlpath = $a->get_path();
|
|
||||||
$dbhost = notags(trim($_POST['dbhost']));
|
$dbhost = notags(trim($_POST['dbhost']));
|
||||||
$dbuser = notags(trim($_POST['dbuser']));
|
$dbuser = notags(trim($_POST['dbuser']));
|
||||||
$dbpass = notags(trim($_POST['dbpass']));
|
$dbpass = notags(trim($_POST['dbpass']));
|
||||||
|
@ -57,7 +57,7 @@ function install_post(App $a) {
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
$urlpath = $a->get_path();
|
$urlpath = $a->getURLPath();
|
||||||
$dbhost = notags(trim($_POST['dbhost']));
|
$dbhost = notags(trim($_POST['dbhost']));
|
||||||
$dbuser = notags(trim($_POST['dbuser']));
|
$dbuser = notags(trim($_POST['dbuser']));
|
||||||
$dbpass = notags(trim($_POST['dbpass']));
|
$dbpass = notags(trim($_POST['dbpass']));
|
||||||
|
@ -70,14 +70,16 @@ function install_post(App $a) {
|
||||||
// connect to db
|
// connect to db
|
||||||
DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
DBA::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
||||||
|
|
||||||
$errors = Install::createConfig($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
|
$install = new Install();
|
||||||
|
|
||||||
if ($errors) {
|
$errors = $install->createConfig($phpath, $urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $timezone, $language, $adminmail, $a->getBasePath());
|
||||||
$a->data['db_failed'] = $errors;
|
|
||||||
|
if ($errors !== true) {
|
||||||
|
$a->data['data'] = $errors;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$errors = Install::installDatabaseStructure();
|
$errors = DBStructure::update(false, true, true);
|
||||||
|
|
||||||
if ($errors) {
|
if ($errors) {
|
||||||
$a->data['db_failed'] = $errors;
|
$a->data['db_failed'] = $errors;
|
||||||
|
@ -97,8 +99,6 @@ function install_content(App $a) {
|
||||||
$wizard_status = "";
|
$wizard_status = "";
|
||||||
$install_title = L10n::t('Friendica Communications Server - Setup');
|
$install_title = L10n::t('Friendica Communications Server - Setup');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (x($a->data, 'db_conn_failed')) {
|
if (x($a->data, 'db_conn_failed')) {
|
||||||
$install_wizard_pass = 2;
|
$install_wizard_pass = 2;
|
||||||
$wizard_status = L10n::t('Could not connect to database.');
|
$wizard_status = L10n::t('Could not connect to database.');
|
||||||
|
@ -125,13 +125,8 @@ function install_content(App $a) {
|
||||||
if (DBA::$connected) {
|
if (DBA::$connected) {
|
||||||
$r = q("SELECT COUNT(*) as `total` FROM `user`");
|
$r = q("SELECT COUNT(*) as `total` FROM `user`");
|
||||||
if (DBA::isResult($r) && $r[0]['total']) {
|
if (DBA::isResult($r) && $r[0]['total']) {
|
||||||
$tpl = get_markup_template('install.tpl');
|
$install_wizard_pass = 2;
|
||||||
return replace_macros($tpl, [
|
$wizard_status = L10n::t('Database already in use.');
|
||||||
'$title' => $install_title,
|
|
||||||
'$pass' => '',
|
|
||||||
'$status' => L10n::t('Database already in use.'),
|
|
||||||
'$text' => '',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,19 +148,21 @@ function install_content(App $a) {
|
||||||
|
|
||||||
$phpath = defaults($_POST, 'phpath', 'php');
|
$phpath = defaults($_POST, 'phpath', 'php');
|
||||||
|
|
||||||
list($checks, $checkspassed) = Install::check($phpath);
|
$install = new Install($phpath);
|
||||||
|
|
||||||
|
$status = $install->checkAll($a->getBasePath(), $a->getBaseURL());
|
||||||
|
|
||||||
$tpl = get_markup_template('install_checks.tpl');
|
$tpl = get_markup_template('install_checks.tpl');
|
||||||
$o .= replace_macros($tpl, [
|
$o .= replace_macros($tpl, [
|
||||||
'$title' => $install_title,
|
'$title' => $install_title,
|
||||||
'$pass' => L10n::t('System check'),
|
'$pass' => L10n::t('System check'),
|
||||||
'$checks' => $checks,
|
'$checks' => $install->getChecks(),
|
||||||
'$passed' => $checkspassed,
|
'$passed' => $status,
|
||||||
'$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
|
'$see_install' => L10n::t('Please see the file "INSTALL.txt".'),
|
||||||
'$next' => L10n::t('Next'),
|
'$next' => L10n::t('Next'),
|
||||||
'$reload' => L10n::t('Check again'),
|
'$reload' => L10n::t('Check again'),
|
||||||
'$phpath' => $phpath,
|
'$phpath' => $phpath,
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => $a->getBaseURL(),
|
||||||
]);
|
]);
|
||||||
return $o;
|
return $o;
|
||||||
}; break;
|
}; break;
|
||||||
|
@ -197,7 +194,7 @@ function install_content(App $a) {
|
||||||
|
|
||||||
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
|
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
|
||||||
|
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => $a->getBaseURL(),
|
||||||
|
|
||||||
'$phpath' => $phpath,
|
'$phpath' => $phpath,
|
||||||
|
|
||||||
|
@ -235,9 +232,7 @@ function install_content(App $a) {
|
||||||
|
|
||||||
'$timezone' => Temporal::getTimezoneField('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
|
'$timezone' => Temporal::getTimezoneField('timezone', L10n::t('Please select a default timezone for your website'), $timezone, ''),
|
||||||
'$language' => ['language', L10n::t('System Language:'), 'en', L10n::t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices],
|
'$language' => ['language', L10n::t('System Language:'), 'en', L10n::t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices],
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => $a->getBaseURL(),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'$submit' => L10n::t('Submit'),
|
'$submit' => L10n::t('Submit'),
|
||||||
|
|
||||||
|
|
|
@ -58,14 +58,9 @@ function invite_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($invitation_only && ($invites_remaining || is_site_admin())) {
|
if ($invitation_only && ($invites_remaining || is_site_admin())) {
|
||||||
$code = autoname(8) . srand(1000, 9999);
|
$code = Friendica\Model\Register::createForInvitation();
|
||||||
$nmessage = str_replace('$invite_code', $code, $message);
|
$nmessage = str_replace('$invite_code', $code, $message);
|
||||||
|
|
||||||
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
|
|
||||||
DBA::escape($code),
|
|
||||||
DBA::escape(DateTimeFormat::utcNow())
|
|
||||||
);
|
|
||||||
|
|
||||||
if (! is_site_admin()) {
|
if (! is_site_admin()) {
|
||||||
$invites_remaining --;
|
$invites_remaining --;
|
||||||
if ($invites_remaining >= 0) {
|
if ($invites_remaining >= 0) {
|
||||||
|
|
44
mod/item.php
44
mod/item.php
|
@ -39,7 +39,7 @@ require_once 'include/items.php';
|
||||||
|
|
||||||
function item_post(App $a) {
|
function item_post(App $a) {
|
||||||
if (!local_user() && !remote_user()) {
|
if (!local_user() && !remote_user()) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once 'include/security.php';
|
require_once 'include/security.php';
|
||||||
|
@ -154,12 +154,12 @@ function item_post(App $a) {
|
||||||
if (($message_id != '') && ($profile_uid != 0)) {
|
if (($message_id != '') && ($profile_uid != 0)) {
|
||||||
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
|
if (Item::exists(['uri' => $message_id, 'uid' => $profile_uid])) {
|
||||||
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
|
logger("Message with URI ".$message_id." already exists for user ".$profile_uid, LOGGER_DEBUG);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow commenting if it is an answer to a public post
|
// Allow commenting if it is an answer to a public post
|
||||||
$allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
$allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
||||||
|
|
||||||
// Now check that valid personal details have been provided
|
// Now check that valid personal details have been provided
|
||||||
if (!can_write_wall($profile_uid) && !$allow_comment) {
|
if (!can_write_wall($profile_uid) && !$allow_comment) {
|
||||||
|
@ -183,7 +183,7 @@ function item_post(App $a) {
|
||||||
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
|
$user = DBA::selectFirst('user', [], ['uid' => $profile_uid]);
|
||||||
|
|
||||||
if (!DBA::isResult($user) && !$parent) {
|
if (!DBA::isResult($user) && !$parent) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories = '';
|
$categories = '';
|
||||||
|
@ -240,7 +240,7 @@ function item_post(App $a) {
|
||||||
$emailcc = notags(trim(defaults($_REQUEST, 'emailcc' , '')));
|
$emailcc = notags(trim(defaults($_REQUEST, 'emailcc' , '')));
|
||||||
$body = escape_tags(trim(defaults($_REQUEST, 'body' , '')));
|
$body = escape_tags(trim(defaults($_REQUEST, 'body' , '')));
|
||||||
$network = notags(trim(defaults($_REQUEST, 'network' , Protocol::DFRN)));
|
$network = notags(trim(defaults($_REQUEST, 'network' , Protocol::DFRN)));
|
||||||
$guid = System::createGUID(32);
|
$guid = System::createUUID();
|
||||||
|
|
||||||
$postopts = defaults($_REQUEST, 'postopts', '');
|
$postopts = defaults($_REQUEST, 'postopts', '');
|
||||||
|
|
||||||
|
@ -343,20 +343,11 @@ function item_post(App $a) {
|
||||||
|
|
||||||
$tags = get_tags($body);
|
$tags = get_tags($body);
|
||||||
|
|
||||||
// Add a tag if the parent contact is from OStatus (This will notify them during delivery)
|
// Add a tag if the parent contact is from ActivityPub or OStatus (This will notify them)
|
||||||
if ($parent) {
|
if ($parent && in_array($thr_parent_contact['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {
|
||||||
if ($thr_parent_contact['network'] == Protocol::OSTATUS) {
|
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
|
||||||
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
|
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
|
||||||
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
|
$tags[] = $contact;
|
||||||
$tags[] = $contact;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parent_contact['network'] == Protocol::OSTATUS) {
|
|
||||||
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
|
|
||||||
if (!stripos(implode($tags), '[url=' . $parent_contact['url'] . ']')) {
|
|
||||||
$tags[] = $contact;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,6 +834,10 @@ function item_post(App $a) {
|
||||||
|
|
||||||
logger('post_complete');
|
logger('post_complete');
|
||||||
|
|
||||||
|
if ($api_source) {
|
||||||
|
return $post_id;
|
||||||
|
}
|
||||||
|
|
||||||
item_post_return(System::baseUrl(), $api_source, $return_path);
|
item_post_return(System::baseUrl(), $api_source, $return_path);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
@ -881,13 +876,13 @@ function item_content(App $a)
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
if (($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
$o = Item::deleteForUser(['id' => $a->argv[2]], local_user());
|
||||||
} else {
|
} else {
|
||||||
$o = drop_item($a->argv[2]);
|
$o = drop_item($a->argv[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
// ajax return: [<item id>, 0 (no perm) | <owner id>]
|
// ajax return: [<item id>, 0 (no perm) | <owner id>]
|
||||||
echo json_encode([intval($a->argv[2]), intval($o)]);
|
echo json_encode([intval($a->argv[2]), intval($o)]);
|
||||||
killme();
|
killme();
|
||||||
|
@ -1020,12 +1015,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
|
||||||
|
|
||||||
$profile = $contact["url"];
|
$profile = $contact["url"];
|
||||||
$alias = $contact["alias"];
|
$alias = $contact["alias"];
|
||||||
$newname = $contact["nick"];
|
$newname = defaults($contact, "name", $contact["nick"]);
|
||||||
|
|
||||||
if (($newname == "") || (($contact["network"] != Protocol::OSTATUS) && ($contact["network"] != Protocol::TWITTER)
|
|
||||||
&& ($contact["network"] != Protocol::STATUSNET))) {
|
|
||||||
$newname = $contact["name"];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there is an url for this persons profile
|
//if there is an url for this persons profile
|
||||||
|
|
|
@ -8,27 +8,31 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
|
|
||||||
function lockview_content(App $a) {
|
function lockview_content(App $a)
|
||||||
|
{
|
||||||
$type = (($a->argc > 1) ? $a->argv[1] : 0);
|
$type = (($a->argc > 1) ? $a->argv[1] : 0);
|
||||||
if (is_numeric($type)) {
|
if (is_numeric($type)) {
|
||||||
$item_id = intval($type);
|
$item_id = intval($type);
|
||||||
$type='item';
|
$type = 'item';
|
||||||
} else {
|
} else {
|
||||||
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
$item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$item_id)
|
if (!$item_id) {
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
if (!in_array($type, ['item','photo','event']))
|
if (!in_array($type, ['item','photo','event'])) {
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
$fields = ['uid', 'private', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
$fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
|
||||||
$condition = ['id' => $item_id];
|
$condition = ['id' => $item_id];
|
||||||
|
|
||||||
if ($type != 'item') {
|
if ($type != 'item') {
|
||||||
$item = DBA::selectFirst($type, $fields, $condition);
|
$item = DBA::selectFirst($type, $fields, $condition);
|
||||||
} else {
|
} else {
|
||||||
|
$fields[] = 'private';
|
||||||
$item = Item::selectFirst($fields, $condition);
|
$item = Item::selectFirst($fields, $condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,18 +47,21 @@ function lockview_content(App $a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($item['private'])
|
||||||
if (($item['private'] == 1) && empty($item['allow_cid']) && empty($item['allow_gid'])
|
&& $item['private'] == 1
|
||||||
&& empty($item['deny_cid']) && empty($item['deny_gid'])) {
|
&& empty($item['allow_cid'])
|
||||||
|
&& empty($item['allow_gid'])
|
||||||
|
&& empty($item['deny_cid'])
|
||||||
|
&& empty($item['deny_gid']))
|
||||||
|
{
|
||||||
echo L10n::t('Remote privacy information not available.') . '<br />';
|
echo L10n::t('Remote privacy information not available.') . '<br />';
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$allowed_users = expand_acl($item['allow_cid']);
|
$allowed_users = expand_acl($item['allow_cid']);
|
||||||
$allowed_groups = expand_acl($item['allow_gid']);
|
$allowed_groups = expand_acl($item['allow_gid']);
|
||||||
$deny_users = expand_acl($item['deny_cid']);
|
$deny_users = expand_acl($item['deny_cid']);
|
||||||
$deny_groups = expand_acl($item['deny_gid']);
|
$deny_groups = expand_acl($item['deny_gid']);
|
||||||
|
|
||||||
$o = L10n::t('Visible to:') . '<br />';
|
$o = L10n::t('Visible to:') . '<br />';
|
||||||
$l = [];
|
$l = [];
|
||||||
|
@ -63,36 +70,44 @@ function lockview_content(App $a) {
|
||||||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||||
DBA::escape(implode(', ', $allowed_groups))
|
DBA::escape(implode(', ', $allowed_groups))
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r))
|
if (DBA::isResult($r)) {
|
||||||
foreach($r as $rr)
|
foreach ($r as $rr) {
|
||||||
$l[] = '<b>' . $rr['name'] . '</b>';
|
$l[] = '<b>' . $rr['name'] . '</b>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($allowed_users)) {
|
if (count($allowed_users)) {
|
||||||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||||
DBA::escape(implode(', ',$allowed_users))
|
DBA::escape(implode(', ', $allowed_users))
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r))
|
if (DBA::isResult($r)) {
|
||||||
foreach($r as $rr)
|
foreach ($r as $rr) {
|
||||||
$l[] = $rr['name'];
|
$l[] = $rr['name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($deny_groups)) {
|
if (count($deny_groups)) {
|
||||||
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
$r = q("SELECT `name` FROM `group` WHERE `id` IN ( %s )",
|
||||||
DBA::escape(implode(', ', $deny_groups))
|
DBA::escape(implode(', ', $deny_groups))
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r))
|
if (DBA::isResult($r)) {
|
||||||
foreach($r as $rr)
|
foreach ($r as $rr) {
|
||||||
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
|
$l[] = '<b><strike>' . $rr['name'] . '</strike></b>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($deny_users)) {
|
if (count($deny_users)) {
|
||||||
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
$r = q("SELECT `name` FROM `contact` WHERE `id` IN ( %s )",
|
||||||
DBA::escape(implode(', ',$deny_users))
|
DBA::escape(implode(', ', $deny_users))
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r))
|
if (DBA::isResult($r)) {
|
||||||
foreach($r as $rr)
|
foreach ($r as $rr) {
|
||||||
$l[] = '<strike>' . $rr['name'] . '</strike>';
|
$l[] = '<strike>' . $rr['name'] . '</strike>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $o . implode(', ', $l);
|
echo $o . implode(', ', $l);
|
||||||
|
|
|
@ -59,16 +59,16 @@ function match_content(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(Config::get('system', 'directory'))) {
|
if (strlen(Config::get('system', 'directory'))) {
|
||||||
$x = Network::post(get_server().'/msearch', $params);
|
$x = Network::post(get_server().'/msearch', $params)->getBody();
|
||||||
} else {
|
} else {
|
||||||
$x = Network::post(System::baseUrl() . '/msearch', $params);
|
$x = Network::post(System::baseUrl() . '/msearch', $params)->getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
$j = json_decode($x);
|
$j = json_decode($x);
|
||||||
|
|
||||||
if ($j->total) {
|
if ($j->total) {
|
||||||
$a->set_pager_total($j->total);
|
$a->setPagerTotal($j->total);
|
||||||
$a->set_pager_itemspage($j->items_page);
|
$a->setPagerItemsPage($j->items_page);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($j->results)) {
|
if (count($j->results)) {
|
||||||
|
|
|
@ -16,6 +16,7 @@ use Friendica\Model\Mail;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Proxy as ProxyUtils;
|
use Friendica\Util\Proxy as ProxyUtils;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
require_once 'include/conversation.php';
|
require_once 'include/conversation.php';
|
||||||
|
|
||||||
|
@ -46,12 +47,6 @@ function message_init(App $a)
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
'$base' => $base
|
'$base' => $base
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$end_tpl = get_markup_template('message-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($end_tpl, [
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
'$base' => $base
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function message_post(App $a)
|
function message_post(App $a)
|
||||||
|
@ -92,7 +87,7 @@ function message_post(App $a)
|
||||||
$a->argc = 2;
|
$a->argc = 2;
|
||||||
$a->argv[1] = 'new';
|
$a->argv[1] = 'new';
|
||||||
} else {
|
} else {
|
||||||
goaway($_SESSION['return_url']);
|
goaway($a->cmd . '/' . $ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +98,7 @@ function message_content(App $a)
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||||
|
@ -160,17 +155,28 @@ function message_content(App $a)
|
||||||
|
|
||||||
// Now check how the user responded to the confirmation query
|
// Now check how the user responded to the confirmation query
|
||||||
if (!empty($_REQUEST['canceled'])) {
|
if (!empty($_REQUEST['canceled'])) {
|
||||||
goaway($_SESSION['return_url']);
|
goaway('/message');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = $a->argv[1];
|
$cmd = $a->argv[1];
|
||||||
if ($cmd === 'drop') {
|
if ($cmd === 'drop') {
|
||||||
|
$message = DBA::selectFirst('mail', ['convid'], ['id' => $a->argv[2], 'uid' => local_user()]);
|
||||||
|
if(!DBA::isResult($message)){
|
||||||
|
info(L10n::t('Conversation not found.') . EOL);
|
||||||
|
goaway('/message');
|
||||||
|
}
|
||||||
|
|
||||||
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
|
if (DBA::delete('mail', ['id' => $a->argv[2], 'uid' => local_user()])) {
|
||||||
info(L10n::t('Message deleted.') . EOL);
|
info(L10n::t('Message deleted.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//goaway(System::baseUrl(true) . '/message' );
|
$conversation = DBA::selectFirst('mail', ['id'], ['convid' => $message['convid'], 'uid' => local_user()]);
|
||||||
goaway($_SESSION['return_url']);
|
if(!DBA::isResult($conversation)){
|
||||||
|
info(L10n::t('Conversation removed.') . EOL);
|
||||||
|
goaway('/message');
|
||||||
|
}
|
||||||
|
|
||||||
|
goaway('/message/' . $conversation['id'] );
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `parent-uri`,`convid` FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($a->argv[2]),
|
intval($a->argv[2]),
|
||||||
|
@ -184,8 +190,7 @@ function message_content(App $a)
|
||||||
info(L10n::t('Conversation removed.') . EOL);
|
info(L10n::t('Conversation removed.') . EOL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//goaway(System::baseUrl(true) . '/message' );
|
goaway('/message' );
|
||||||
goaway($_SESSION['return_url']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,13 +204,6 @@ function message_content(App $a)
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('msg-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
'$nickname' => $a->user['nickname'],
|
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
|
||||||
]);
|
|
||||||
|
|
||||||
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : [];
|
$preselect = isset($a->argv[2]) ? [$a->argv[2]] : [];
|
||||||
|
|
||||||
$prename = $preurl = $preid = '';
|
$prename = $preurl = $preid = '';
|
||||||
|
@ -281,7 +279,7 @@ function message_content(App $a)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$a->set_pager_total($r[0]['total']);
|
$a->setPagerTotal($r[0]['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
|
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
|
||||||
|
@ -344,13 +342,6 @@ function message_content(App $a)
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('msg-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
'$nickname' => $a->user['nickname'],
|
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
|
||||||
]);
|
|
||||||
|
|
||||||
$mails = [];
|
$mails = [];
|
||||||
$seen = 0;
|
$seen = 0;
|
||||||
$unknown = false;
|
$unknown = false;
|
||||||
|
@ -488,7 +479,7 @@ function render_messages(array $msg, $t)
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$from_name' => $participants,
|
'$from_name' => $participants,
|
||||||
'$from_url' => Contact::magicLink($rr['url']),
|
'$from_url' => Contact::magicLink($rr['url']),
|
||||||
'$from_addr' => $contact['addr'],
|
'$from_addr' => defaults($contact, 'addr', ''),
|
||||||
'$sparkle' => ' sparkle',
|
'$sparkle' => ' sparkle',
|
||||||
'$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
|
'$from_photo' => ProxyUtils::proxifyUrl($from_photo, false, ProxyUtils::SIZE_THUMB),
|
||||||
'$subject' => $subject_e,
|
'$subject' => $subject_e,
|
||||||
|
|
|
@ -302,7 +302,7 @@ function networkPager($a, $update)
|
||||||
$itemspage_network = $a->force_max_items;
|
$itemspage_network = $a->force_max_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_pager_itemspage($itemspage_network);
|
$a->setPagerItemsPage($itemspage_network);
|
||||||
|
|
||||||
return sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
return sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
if ($last_received != '') {
|
if ($last_received != '') {
|
||||||
$last_date = $last_received;
|
$last_date = $last_received;
|
||||||
$sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
|
$sql_range .= sprintf(" AND $sql_table.`received` < '%s'", DBA::escape($last_received));
|
||||||
$a->set_pager_page(1);
|
$a->setPagerPage(1);
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -729,7 +729,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
if ($last_commented != '') {
|
if ($last_commented != '') {
|
||||||
$last_date = $last_commented;
|
$last_date = $last_commented;
|
||||||
$sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
|
$sql_range .= sprintf(" AND $sql_table.`commented` < '%s'", DBA::escape($last_commented));
|
||||||
$a->set_pager_page(1);
|
$a->setPagerPage(1);
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -737,14 +737,14 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
if ($last_created != '') {
|
if ($last_created != '') {
|
||||||
$last_date = $last_created;
|
$last_date = $last_created;
|
||||||
$sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
|
$sql_range .= sprintf(" AND $sql_table.`created` < '%s'", DBA::escape($last_created));
|
||||||
$a->set_pager_page(1);
|
$a->setPagerPage(1);
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'id':
|
case 'id':
|
||||||
if (($last_id > 0) && ($sql_table == '`thread`')) {
|
if (($last_id > 0) && ($sql_table == '`thread`')) {
|
||||||
$sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
|
$sql_range .= sprintf(" AND $sql_table.`iid` < '%s'", DBA::escape($last_id));
|
||||||
$a->set_pager_page(1);
|
$a->setPagerPage(1);
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -810,7 +810,7 @@ function networkThreadedView(App $a, $update, $parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show it when unfiltered (no groups, no networks, ...)
|
// Only show it when unfiltered (no groups, no networks, ...)
|
||||||
if (in_array($nets, ['', Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
|
if (in_array($nets, ['', Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$top_limit = current($r)['order_date'];
|
$top_limit = current($r)['order_date'];
|
||||||
$bottom_limit = end($r)['order_date'];
|
$bottom_limit = end($r)['order_date'];
|
||||||
|
|
|
@ -36,13 +36,13 @@ function newmember_content(App $a)
|
||||||
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . L10n::t('Importing Emails') . '</a><br />' . L10n::t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="settings/connectors">' . L10n::t('Importing Emails') . '</a><br />' . L10n::t('Enter your email access information on your Connector Settings page if you wish to import and interact with friends or mailing lists from your email INBOX') . '</li>' . EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Go to Your Contacts Page') . '</a><br />' . L10n::t('Your Contacts page is your gateway to managing friendships and connecting with friends on other networks. Typically you enter their address or site URL in the <em>Add New Contact</em> dialog.') . '</li>' . EOL;
|
||||||
$o .= '<li>' . '<a target="newmember" href="directory">' . L10n::t("Go to Your Site's Directory") . '</a><br />' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="directory">' . L10n::t("Go to Your Site's Directory") . '</a><br />' . L10n::t('The Directory page lets you find other people in this network or other federated sites. Look for a <em>Connect</em> or <em>Follow</em> link on their profile page. Provide your own Identity Address if requested.') . '</li>' . EOL;
|
||||||
$o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Finding New People') . '</a><br />' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Finding New People') . '</a><br />' . L10n::t("On the side panel of the Contacts page are several tools to find new friends. We can match people by interest, look up people by name or interest, and provide suggestions based on network relationships. On a brand new site, friend suggestions will usually begin to be populated within 24 hours.") . '</li>' . EOL;
|
||||||
$o .= '</ul>';
|
$o .= '</ul>';
|
||||||
$o .= '<h4>' . L10n::t('Groups') . '</h4>';
|
$o .= '<h4>' . L10n::t('Groups') . '</h4>';
|
||||||
$o .= '<ul>';
|
$o .= '<ul>';
|
||||||
$o .= '<li>' . '<a target="newmember" href="contacts">' . L10n::t('Group Your Contacts') . '</a><br />' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="contact">' . L10n::t('Group Your Contacts') . '</a><br />' . L10n::t('Once you have made some friends, organize them into private conversation groups from the sidebar of your Contacts page and then you can interact with each group privately on your Network page.') . '</li>' . EOL;
|
||||||
|
|
||||||
if (Config::get('system', 'newuser_private')) {
|
if (Config::get('system', 'newuser_private')) {
|
||||||
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . L10n::t("Why Aren't My Posts Public?") . '</a><br />' . L10n::t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
|
$o .= '<li>' . '<a target="newmember" href="help/Groups-and-Privacy">' . L10n::t("Why Aren't My Posts Public?") . '</a><br />' . L10n::t("Friendica respects your privacy. By default, your posts will only show up to people you've added as friends. For more information, see the help section from the link above.") . '</li>' . EOL;
|
||||||
|
|
|
@ -215,7 +215,7 @@ function nodeinfo_cron() {
|
||||||
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
|
logger('local_comments: ' . $local_comments, LOGGER_DEBUG);
|
||||||
|
|
||||||
// Now trying to register
|
// Now trying to register
|
||||||
$url = 'http://the-federation.info/register/'.$a->get_hostname();
|
$url = 'http://the-federation.info/register/'.$a->getHostName();
|
||||||
logger('registering url: '.$url, LOGGER_DEBUG);
|
logger('registering url: '.$url, LOGGER_DEBUG);
|
||||||
$ret = Network::fetchUrl($url);
|
$ret = Network::fetchUrl($url);
|
||||||
logger('registering answer: '.$ret, LOGGER_DEBUG);
|
logger('registering answer: '.$ret, LOGGER_DEBUG);
|
||||||
|
|
|
@ -61,7 +61,7 @@ function notes_content(App $a, $update = false)
|
||||||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
||||||
'wall' => false, 'contact-id'=> $a->contact['id']];
|
'wall' => false, 'contact-id'=> $a->contact['id']];
|
||||||
|
|
||||||
$a->set_pager_itemspage(40);
|
$a->setPagerItemsPage(40);
|
||||||
|
|
||||||
$params = ['order' => ['created' => true],
|
$params = ['order' => ['created' => true],
|
||||||
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||||
|
@ -70,8 +70,11 @@ function notes_content(App $a, $update = false)
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$count = count($r);
|
$notes = DBA::toArray($r);
|
||||||
$o .= conversation($a, DBA::toArray($r), 'notes', $update);
|
|
||||||
|
$count = count($notes);
|
||||||
|
|
||||||
|
$o .= conversation($a, $notes, 'notes', $update);
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= alt_pager($a, $count);
|
$o .= alt_pager($a, $count);
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\NotificationsManager;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
function notifications_post(App $a)
|
function notifications_post(App $a)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +22,7 @@ function notifications_post(App $a)
|
||||||
|
|
||||||
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
|
$request_id = (($a->argc > 1) ? $a->argv[1] : 0);
|
||||||
|
|
||||||
if ($request_id === "all") {
|
if ($request_id === 'all') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +66,11 @@ function notifications_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = (x($_REQUEST,'page') ? $_REQUEST['page'] : 1);
|
$page = defaults($_REQUEST, 'page', 1);
|
||||||
$show = (x($_REQUEST,'show') ? $_REQUEST['show'] : 0);
|
$show = defaults($_REQUEST, 'show', 0);
|
||||||
|
|
||||||
Nav::setSelected('notifications');
|
Nav::setSelected('notifications');
|
||||||
|
|
||||||
|
@ -87,10 +88,11 @@ function notifications_content(App $a)
|
||||||
$perpage = 20;
|
$perpage = 20;
|
||||||
$startrec = ($page * $perpage) - $perpage;
|
$startrec = ($page * $perpage) - $perpage;
|
||||||
|
|
||||||
|
$notif_header = L10n::t('Notifications');
|
||||||
|
|
||||||
// Get introductions
|
// Get introductions
|
||||||
if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
|
if ((($a->argc > 1) && ($a->argv[1] == 'intros')) || (($a->argc == 1))) {
|
||||||
Nav::setSelected('introductions');
|
Nav::setSelected('introductions');
|
||||||
$notif_header = L10n::t('Notifications');
|
|
||||||
|
|
||||||
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
|
$all = (($a->argc > 2) && ($a->argv[2] == 'all'));
|
||||||
|
|
||||||
|
@ -115,12 +117,10 @@ function notifications_content(App $a)
|
||||||
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
} elseif (($a->argc > 1) && ($a->argv[1] == 'home')) {
|
||||||
$notif_header = L10n::t('Home Notifications');
|
$notif_header = L10n::t('Home Notifications');
|
||||||
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
|
$notifs = $nm->homeNotifs($show, $startrec, $perpage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the pager
|
// Set the pager
|
||||||
$a->set_pager_itemspage($perpage);
|
$a->setPagerItemsPage($perpage);
|
||||||
|
|
||||||
// Add additional informations (needed for json output)
|
// Add additional informations (needed for json output)
|
||||||
$notifs['items_page'] = $a->pager['itemspage'];
|
$notifs['items_page'] = $a->pager['itemspage'];
|
||||||
|
@ -133,14 +133,15 @@ function notifications_content(App $a)
|
||||||
|
|
||||||
$notif_tpl = get_markup_template('notifications.tpl');
|
$notif_tpl = get_markup_template('notifications.tpl');
|
||||||
|
|
||||||
if (!isset($notifs['ident'])) {
|
$notif_show_lnk = [
|
||||||
logger('Missing data in notifs: ' . System::callstack(20), LOGGER_DEBUG);
|
'href' => ($show ? 'notifications/' . $notifs['ident'] : 'notifications/' . $notifs['ident'] . '?show=all' ),
|
||||||
}
|
'text' => ($show ? L10n::t('Show unread') : L10n::t('Show all')),
|
||||||
|
];
|
||||||
|
|
||||||
// Process the data for template creation
|
// Process the data for template creation
|
||||||
if ($notifs['ident'] === 'introductions') {
|
if (defaults($notifs, 'ident', '') === 'introductions') {
|
||||||
$sugg = get_markup_template('suggestions.tpl');
|
$sugg = get_markup_template('suggestions.tpl');
|
||||||
$tpl = get_markup_template("intros.tpl");
|
$tpl = get_markup_template('intros.tpl');
|
||||||
|
|
||||||
// The link to switch between ignored and normal connection requests
|
// The link to switch between ignored and normal connection requests
|
||||||
$notif_show_lnk = [
|
$notif_show_lnk = [
|
||||||
|
@ -150,127 +151,121 @@ function notifications_content(App $a)
|
||||||
|
|
||||||
// Loop through all introduction notifications.This creates an array with the output html for each
|
// Loop through all introduction notifications.This creates an array with the output html for each
|
||||||
// introduction
|
// introduction
|
||||||
foreach ($notifs['notifications'] as $it) {
|
foreach ($notifs['notifications'] as $notif) {
|
||||||
|
|
||||||
// There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
|
// There are two kind of introduction. Contacts suggested by other contacts and normal connection requests.
|
||||||
// We have to distinguish between these two because they use different data.
|
// We have to distinguish between these two because they use different data.
|
||||||
switch ($it['label']) {
|
switch ($notif['label']) {
|
||||||
case 'friend_suggestion':
|
case 'friend_suggestion':
|
||||||
$notif_content[] = replace_macros($sugg, [
|
$notif_content[] = replace_macros($sugg, [
|
||||||
'$type' => $it['label'],
|
'$type' => $notif['label'],
|
||||||
'$str_notifytype' => L10n::t('Notification type:'),
|
'$str_notifytype' => L10n::t('Notification type:'),
|
||||||
'$notify_type' => $it['notify_type'],
|
'$notify_type'=> $notif['notify_type'],
|
||||||
'$intro_id' => $it['intro_id'],
|
'$intro_id' => $notif['intro_id'],
|
||||||
'$lbl_madeby' => L10n::t('Suggested by:'),
|
'$lbl_madeby' => L10n::t('Suggested by:'),
|
||||||
'$madeby' => $it['madeby'],
|
'$madeby' => $notif['madeby'],
|
||||||
'$madeby_url' => $it['madeby_url'],
|
'$madeby_url' => $notif['madeby_url'],
|
||||||
'$madeby_zrl' => $it['madeby_zrl'],
|
'$madeby_zrl' => $notif['madeby_zrl'],
|
||||||
'$madeby_addr' => $it['madeby_addr'],
|
'$madeby_addr'=> $notif['madeby_addr'],
|
||||||
'$contact_id' => $it['contact_id'],
|
'$contact_id' => $notif['contact_id'],
|
||||||
'$photo' => $it['photo'],
|
'$photo' => $notif['photo'],
|
||||||
'$fullname' => $it['name'],
|
'$fullname' => $notif['name'],
|
||||||
'$url' => $it['url'],
|
'$url' => $notif['url'],
|
||||||
'$zrl' => $it['zrl'],
|
'$zrl' => $notif['zrl'],
|
||||||
'$lbl_url' => L10n::t('Profile URL'),
|
'$lbl_url' => L10n::t('Profile URL'),
|
||||||
'$addr' => $it['addr'],
|
'$addr' => $notif['addr'],
|
||||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
|
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($notif['hidden'] == 1), ''],
|
||||||
|
'$knowyou' => $notif['knowyou'],
|
||||||
'$knowyou' => $it['knowyou'],
|
'$approve' => L10n::t('Approve'),
|
||||||
'$approve' => L10n::t('Approve'),
|
'$note' => $notif['note'],
|
||||||
'$note' => $it['note'],
|
'$request' => $notif['request'],
|
||||||
'$request' => $it['request'],
|
'$ignore' => L10n::t('Ignore'),
|
||||||
'$ignore' => L10n::t('Ignore'),
|
'$discard' => L10n::t('Discard'),
|
||||||
'$discard' => L10n::t('Discard'),
|
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Normal connection requests
|
// Normal connection requests
|
||||||
default:
|
default:
|
||||||
$friend_selected = (($it['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
$friend_selected = (($notif['network'] !== Protocol::OSTATUS) ? ' checked="checked" ' : ' disabled ');
|
||||||
$fan_selected = (($it['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : '');
|
$fan_selected = (($notif['network'] === Protocol::OSTATUS) ? ' checked="checked" disabled ' : '');
|
||||||
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
|
||||||
|
|
||||||
$knowyou = '';
|
|
||||||
$lbl_knowyou = '';
|
$lbl_knowyou = '';
|
||||||
$dfrn_text = '';
|
$knowyou = '';
|
||||||
$helptext = '';
|
$helptext = '';
|
||||||
$helptext2 = '';
|
$helptext2 = '';
|
||||||
$helptext3 = '';
|
$helptext3 = '';
|
||||||
|
|
||||||
if ($it['network'] === Protocol::DFRN || $it['network'] === Protocol::DIASPORA) {
|
if ($notif['network'] === Protocol::DFRN) {
|
||||||
if ($it['network'] === Protocol::DFRN) {
|
$lbl_knowyou = L10n::t('Claims to be known to you: ');
|
||||||
$lbl_knowyou = L10n::t('Claims to be known to you: ');
|
$knowyou = (($notif['knowyou']) ? L10n::t('yes') : L10n::t('no'));
|
||||||
$knowyou = (($it['knowyou']) ? L10n::t('yes') : L10n::t('no'));
|
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $notif['name'], $notif['name']);
|
||||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
|
$helptext3 = L10n::t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']);
|
||||||
$helptext3 = L10n::t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
|
} elseif ($notif['network'] === Protocol::DIASPORA) {
|
||||||
} else {
|
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
||||||
$knowyou = '';
|
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $notif['name'], $notif['name']);
|
||||||
$helptext = L10n::t('Shall your connection be bidirectional or not?');
|
$helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $notif['name']);
|
||||||
$helptext2 = L10n::t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $it['name'], $it['name']);
|
|
||||||
$helptext3 = L10n::t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $it['name']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$dfrn_text = replace_macros($dfrn_tpl,[
|
$dfrn_tpl = get_markup_template('netfriend.tpl');
|
||||||
'$intro_id' => $it['intro_id'],
|
$dfrn_text = replace_macros($dfrn_tpl, [
|
||||||
|
'$intro_id' => $notif['intro_id'],
|
||||||
'$friend_selected' => $friend_selected,
|
'$friend_selected' => $friend_selected,
|
||||||
'$fan_selected' => $fan_selected,
|
'$fan_selected'=> $fan_selected,
|
||||||
'$approve_as1' => $helptext,
|
'$approve_as1' => $helptext,
|
||||||
'$approve_as2' => $helptext2,
|
'$approve_as2' => $helptext2,
|
||||||
'$approve_as3' => $helptext3,
|
'$approve_as3' => $helptext3,
|
||||||
'$as_friend' => L10n::t('Friend'),
|
'$as_friend' => L10n::t('Friend'),
|
||||||
'$as_fan' => (($it['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
|
'$as_fan' => (($notif['network'] == Protocol::DIASPORA) ? L10n::t('Sharer') : L10n::t('Subscriber'))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$header = $it["name"];
|
$header = $notif['name'];
|
||||||
|
|
||||||
if ($it["addr"] != "") {
|
if ($notif['addr'] != '') {
|
||||||
$header .= " <".$it["addr"].">";
|
$header .= ' <' . $notif['addr'] . '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$header .= " (".ContactSelector::networkToName($it['network'], $it['url']).")";
|
$header .= ' (' . ContactSelector::networkToName($notif['network'], $notif['url']) . ')';
|
||||||
|
|
||||||
if ($it['network'] != Protocol::DIASPORA) {
|
if ($notif['network'] != Protocol::DIASPORA) {
|
||||||
$discard = L10n::t('Discard');
|
$discard = L10n::t('Discard');
|
||||||
} else {
|
} else {
|
||||||
$discard = '';
|
$discard = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$notif_content[] = replace_macros($tpl, [
|
$notif_content[] = replace_macros($tpl, [
|
||||||
'$type' => $it['label'],
|
'$type' => $notif['label'],
|
||||||
'$header' => htmlentities($header),
|
'$header' => htmlentities($header),
|
||||||
'$str_notifytype' => L10n::t('Notification type:'),
|
'$str_notifytype' => L10n::t('Notification type:'),
|
||||||
'$notify_type' => $it['notify_type'],
|
'$notify_type' => $notif['notify_type'],
|
||||||
'$dfrn_text' => $dfrn_text,
|
'$dfrn_text' => $dfrn_text,
|
||||||
'$dfrn_id' => $it['dfrn_id'],
|
'$dfrn_id' => $notif['dfrn_id'],
|
||||||
'$uid' => $it['uid'],
|
'$uid' => $notif['uid'],
|
||||||
'$intro_id' => $it['intro_id'],
|
'$intro_id' => $notif['intro_id'],
|
||||||
'$contact_id' => $it['contact_id'],
|
'$contact_id' => $notif['contact_id'],
|
||||||
'$photo' => $it['photo'],
|
'$photo' => $notif['photo'],
|
||||||
'$fullname' => $it['name'],
|
'$fullname' => $notif['name'],
|
||||||
'$location' => $it['location'],
|
'$location' => $notif['location'],
|
||||||
'$lbl_location' => L10n::t('Location:'),
|
'$lbl_location'=> L10n::t('Location:'),
|
||||||
'$about' => $it['about'],
|
'$about' => $notif['about'],
|
||||||
'$lbl_about' => L10n::t('About:'),
|
'$lbl_about' => L10n::t('About:'),
|
||||||
'$keywords' => $it['keywords'],
|
'$keywords' => $notif['keywords'],
|
||||||
'$lbl_keywords' => L10n::t('Tags:'),
|
'$lbl_keywords'=> L10n::t('Tags:'),
|
||||||
'$gender' => $it['gender'],
|
'$gender' => $notif['gender'],
|
||||||
'$lbl_gender' => L10n::t('Gender:'),
|
'$lbl_gender' => L10n::t('Gender:'),
|
||||||
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''],
|
'$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($notif['hidden'] == 1), ''],
|
||||||
'$url' => $it['url'],
|
'$url' => $notif['url'],
|
||||||
'$zrl' => $it['zrl'],
|
'$zrl' => $notif['zrl'],
|
||||||
'$lbl_url' => L10n::t('Profile URL'),
|
'$lbl_url' => L10n::t('Profile URL'),
|
||||||
'$addr' => $it['addr'],
|
'$addr' => $notif['addr'],
|
||||||
'$lbl_knowyou' => $lbl_knowyou,
|
'$lbl_knowyou' => $lbl_knowyou,
|
||||||
'$lbl_network' => L10n::t('Network:'),
|
'$lbl_network' => L10n::t('Network:'),
|
||||||
'$network' => ContactSelector::networkToName($it['network'], $it['url']),
|
'$network' => ContactSelector::networkToName($notif['network'], $notif['url']),
|
||||||
'$knowyou' => $knowyou,
|
'$knowyou' => $knowyou,
|
||||||
'$approve' => L10n::t('Approve'),
|
'$approve' => L10n::t('Approve'),
|
||||||
'$note' => $it['note'],
|
'$note' => $notif['note'],
|
||||||
'$ignore' => L10n::t('Ignore'),
|
'$ignore' => L10n::t('Ignore'),
|
||||||
'$discard' => $discard,
|
'$discard' => $discard,
|
||||||
|
|
||||||
]);
|
]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -280,57 +275,47 @@ function notifications_content(App $a)
|
||||||
info(L10n::t('No introductions.') . EOL);
|
info(L10n::t('No introductions.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal notifications (no introductions)
|
// Normal notifications (no introductions)
|
||||||
} else {
|
} elseif (!empty($notifs['notifications'])) {
|
||||||
// The template files we need in different cases for formatting the content
|
|
||||||
$tpl_item_like = 'notifications_likes_item.tpl';
|
|
||||||
$tpl_item_dislike = 'notifications_dislikes_item.tpl';
|
|
||||||
$tpl_item_attend = 'notifications_attend_item.tpl';
|
|
||||||
$tpl_item_attendno = 'notifications_attend_item.tpl';
|
|
||||||
$tpl_item_attendmaybe = 'notifications_attend_item.tpl';
|
|
||||||
$tpl_item_friend = 'notifications_friends_item.tpl';
|
|
||||||
$tpl_item_comment = 'notifications_comments_item.tpl';
|
|
||||||
$tpl_item_post = 'notifications_posts_item.tpl';
|
|
||||||
$tpl_item_notify = 'notify.tpl';
|
|
||||||
|
|
||||||
// Loop trough ever notification This creates an array with the output html for each
|
// Loop trough ever notification This creates an array with the output html for each
|
||||||
// notification and apply the correct template according to the notificationtype (label).
|
// notification and apply the correct template according to the notificationtype (label).
|
||||||
foreach ($notifs['notifications'] as $it) {
|
foreach ($notifs['notifications'] as $notif) {
|
||||||
|
$notification_templates = [
|
||||||
|
'like' => 'notifications_likes_item.tpl',
|
||||||
|
'dislike' => 'notifications_dislikes_item.tpl',
|
||||||
|
'attend' => 'notifications_attend_item.tpl',
|
||||||
|
'attendno' => 'notifications_attend_item.tpl',
|
||||||
|
'attendmaybe' => 'notifications_attend_item.tpl',
|
||||||
|
'friend' => 'notifications_friends_item.tpl',
|
||||||
|
'comment' => 'notifications_comments_item.tpl',
|
||||||
|
'post' => 'notifications_posts_item.tpl',
|
||||||
|
'notify' => 'notify.tpl',
|
||||||
|
];
|
||||||
|
|
||||||
// We use the notification label to get the correct template file
|
$tpl_notif = get_markup_template($notification_templates[$notif['label']]);
|
||||||
$tpl_var_name = 'tpl_item_'.$it['label'];
|
|
||||||
$tpl_notif = get_markup_template($$tpl_var_name);
|
|
||||||
|
|
||||||
$notif_content[] = replace_macros($tpl_notif,[
|
$notif_content[] = replace_macros($tpl_notif, [
|
||||||
'$item_label' => $it['label'],
|
'$item_label' => $notif['label'],
|
||||||
'$item_link' => $it['link'],
|
'$item_link' => $notif['link'],
|
||||||
'$item_image' => $it['image'],
|
'$item_image' => $notif['image'],
|
||||||
'$item_url' => $it['url'],
|
'$item_url' => $notif['url'],
|
||||||
'$item_text' => $it['text'],
|
'$item_text' => $notif['text'],
|
||||||
'$item_when' => $it['when'],
|
'$item_when' => $notif['when'],
|
||||||
'$item_ago' => $it['ago'],
|
'$item_ago' => $notif['ago'],
|
||||||
'$item_seen' => $it['seen'],
|
'$item_seen' => $notif['seen'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
$notif_show_lnk = [
|
$notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
|
||||||
'href' => ($show ? 'notifications/'.$notifs['ident'] : 'notifications/'.$notifs['ident'].'?show=all' ),
|
|
||||||
'text' => ($show ? L10n::t('Show unread') : L10n::t('Show all')),
|
|
||||||
];
|
|
||||||
|
|
||||||
// Output if there aren't any notifications available
|
|
||||||
if (count($notifs['notifications']) == 0) {
|
|
||||||
$notif_nocontent = L10n::t('No more %s notifications.', $notifs['ident']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$o .= replace_macros($notif_tpl, [
|
$o .= replace_macros($notif_tpl, [
|
||||||
'$notif_header' => $notif_header,
|
'$notif_header' => $notif_header,
|
||||||
'$tabs' => $tabs,
|
'$tabs' => $tabs,
|
||||||
'$notif_content' => $notif_content,
|
'$notif_content' => $notif_content,
|
||||||
'$notif_nocontent' => $notif_nocontent,
|
'$notif_nocontent' => $notif_nocontent,
|
||||||
'$notif_show_lnk' => $notif_show_lnk,
|
'$notif_show_lnk' => $notif_show_lnk,
|
||||||
'$notif_paginate' => alt_pager($a, count($notif_content))
|
'$notif_paginate' => alt_pager($a, count($notif_content))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
|
@ -27,7 +27,7 @@ function notify_init(App $a)
|
||||||
$nm->setSeen($note);
|
$nm->setSeen($note);
|
||||||
|
|
||||||
// The friendica client has problems with the GUID. this is some workaround
|
// The friendica client has problems with the GUID. this is some workaround
|
||||||
if ($a->is_friendica_app()) {
|
if ($a->isFriendicaApp()) {
|
||||||
require_once("include/items.php");
|
require_once("include/items.php");
|
||||||
$urldata = parse_url($note['link']);
|
$urldata = parse_url($note['link']);
|
||||||
$guid = basename($urldata["path"]);
|
$guid = basename($urldata["path"]);
|
||||||
|
|
|
@ -19,7 +19,7 @@ function openid_content(App $a) {
|
||||||
|
|
||||||
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
|
if((x($_GET,'openid_mode')) && (x($_SESSION,'openid'))) {
|
||||||
|
|
||||||
$openid = new LightOpenID($a->get_hostname());
|
$openid = new LightOpenID($a->getHostName());
|
||||||
|
|
||||||
if($openid->validate()) {
|
if($openid->validate()) {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ function opensearch_content(App $a) {
|
||||||
|
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => System::baseUrl(),
|
||||||
'$nodename' => $a->get_hostname(),
|
'$nodename' => $a->getHostName(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
echo $o;
|
echo $o;
|
||||||
|
|
|
@ -15,7 +15,7 @@ function ostatus_subscribe_content(App $a) {
|
||||||
|
|
||||||
if (! local_user()) {
|
if (! local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
goaway($_SESSION['return_url']);
|
goaway('/ostatus_subscribe');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ function ostatus_subscribe_content(App $a) {
|
||||||
$api = $contact["baseurl"]."/api/";
|
$api = $contact["baseurl"]."/api/";
|
||||||
|
|
||||||
// Fetching friends
|
// Fetching friends
|
||||||
$data = Network::curl($api."statuses/friends.json?screen_name=".$contact["nick"]);
|
$curlResult = Network::curl($api."statuses/friends.json?screen_name=".$contact["nick"]);
|
||||||
|
|
||||||
if (!$data["success"]) {
|
if (!$curlResult->isSuccess()) {
|
||||||
PConfig::delete($uid, "ostatus", "legacy_contact");
|
PConfig::delete($uid, "ostatus", "legacy_contact");
|
||||||
return $o.L10n::t("Couldn't fetch friends for contact.");
|
return $o.L10n::t("Couldn't fetch friends for contact.");
|
||||||
}
|
}
|
||||||
|
|
||||||
PConfig::set($uid, "ostatus", "legacy_friends", $data["body"]);
|
PConfig::set($uid, "ostatus", "legacy_friends", $curlResult->getBody());
|
||||||
}
|
}
|
||||||
|
|
||||||
$friends = json_decode(PConfig::get($uid, "ostatus", "legacy_friends"));
|
$friends = json_decode(PConfig::get($uid, "ostatus", "legacy_friends"));
|
||||||
|
@ -72,8 +72,8 @@ function ostatus_subscribe_content(App $a) {
|
||||||
|
|
||||||
$o .= "<p>".$counter."/".$total.": ".$url;
|
$o .= "<p>".$counter."/".$total.": ".$url;
|
||||||
|
|
||||||
$data = Probe::uri($url);
|
$curlResult = Probe::uri($url);
|
||||||
if ($data["network"] == Protocol::OSTATUS) {
|
if ($curlResult["network"] == Protocol::OSTATUS) {
|
||||||
$result = Contact::createFromProbe($uid, $url, true, Protocol::OSTATUS);
|
$result = Contact::createFromProbe($uid, $url, true, Protocol::OSTATUS);
|
||||||
if ($result["success"]) {
|
if ($result["success"]) {
|
||||||
$o .= " - ".L10n::t("success");
|
$o .= " - ".L10n::t("success");
|
||||||
|
|
|
@ -8,128 +8,128 @@
|
||||||
* information and does format this information to BBCode
|
* information and does format this information to BBCode
|
||||||
*
|
*
|
||||||
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
|
* @see ParseUrl::getSiteinfo() for more information about scraping embeddable content
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
|
||||||
require_once("include/items.php");
|
require_once 'include/items.php';
|
||||||
|
|
||||||
function parse_url_content(App $a) {
|
|
||||||
|
|
||||||
|
function parse_url_content(App $a)
|
||||||
|
{
|
||||||
$text = null;
|
$text = null;
|
||||||
$str_tags = "";
|
$str_tags = '';
|
||||||
|
|
||||||
$br = "\n";
|
$br = "\n";
|
||||||
|
|
||||||
if (!empty($_GET["binurl"])) {
|
if (!empty($_GET['binurl'])) {
|
||||||
$url = trim(hex2bin($_GET["binurl"]));
|
$url = trim(hex2bin($_GET['binurl']));
|
||||||
} else {
|
} else {
|
||||||
$url = trim($_GET["url"]);
|
$url = trim($_GET['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET["title"])) {
|
if (!empty($_GET['title'])) {
|
||||||
$title = strip_tags(trim($_GET["title"]));
|
$title = strip_tags(trim($_GET['title']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET["description"])) {
|
if (!empty($_GET['description'])) {
|
||||||
$text = strip_tags(trim($_GET["description"]));
|
$text = strip_tags(trim($_GET['description']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_GET["tags"])) {
|
if (!empty($_GET['tags'])) {
|
||||||
$arr_tags = ParseUrl::convertTagsToArray($_GET["tags"]);
|
$arr_tags = ParseUrl::convertTagsToArray($_GET['tags']);
|
||||||
if (count($arr_tags)) {
|
if (count($arr_tags)) {
|
||||||
$str_tags = $br . implode(" ", $arr_tags) . $br;
|
$str_tags = $br . implode(' ', $arr_tags) . $br;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add url scheme if it is missing
|
// Add url scheme if it is missing
|
||||||
$arrurl = parse_url($url);
|
$arrurl = parse_url($url);
|
||||||
if (!x($arrurl, "scheme")) {
|
if (!x($arrurl, 'scheme')) {
|
||||||
if (x($arrurl, "host")) {
|
if (x($arrurl, 'host')) {
|
||||||
$url = "http:".$url;
|
$url = 'http:' . $url;
|
||||||
} else {
|
} else {
|
||||||
$url = "http://".$url;
|
$url = 'http://' . $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger("prse_url: " . $url);
|
logger($url);
|
||||||
|
|
||||||
// Check if the URL is an image, video or audio file. If so format
|
// Check if the URL is an image, video or audio file. If so format
|
||||||
// the URL with the corresponding BBCode media tag
|
// the URL with the corresponding BBCode media tag
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
// Fetch the header of the URL
|
// Fetch the header of the URL
|
||||||
$result = Network::curl($url, false, $redirects, ["novalidate" => true, "nobody" => true]);
|
$curlResponse = Network::curl($url, false, $redirects, ['novalidate' => true, 'nobody' => true]);
|
||||||
if($result["success"]) {
|
|
||||||
|
if ($curlResponse->isSuccess()) {
|
||||||
// Convert the header fields into an array
|
// Convert the header fields into an array
|
||||||
$hdrs = [];
|
$hdrs = [];
|
||||||
$h = explode("\n", $result["header"]);
|
$h = explode("\n", $curlResponse->getHeader());
|
||||||
foreach ($h as $l) {
|
foreach ($h as $l) {
|
||||||
$header = array_map("trim", explode(":", trim($l), 2));
|
$header = array_map('trim', explode(':', trim($l), 2));
|
||||||
if (count($header) == 2) {
|
if (count($header) == 2) {
|
||||||
list($k,$v) = $header;
|
list($k, $v) = $header;
|
||||||
$hdrs[$k] = $v;
|
$hdrs[$k] = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (array_key_exists("Content-Type", $hdrs)) {
|
$type = null;
|
||||||
$type = $hdrs["Content-Type"];
|
if (array_key_exists('Content-Type', $hdrs)) {
|
||||||
|
$type = $hdrs['Content-Type'];
|
||||||
}
|
}
|
||||||
if ($type) {
|
if ($type) {
|
||||||
if(stripos($type, "image/") !== false) {
|
if (stripos($type, 'image/') !== false) {
|
||||||
echo $br . "[img]" . $url . "[/img]" . $br;
|
echo $br . '[img]' . $url . '[/img]' . $br;
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
if (stripos($type, "video/") !== false) {
|
if (stripos($type, 'video/') !== false) {
|
||||||
echo $br . "[video]" . $url . "[/video]" . $br;
|
echo $br . '[video]' . $url . '[/video]' . $br;
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
if (stripos($type, "audio/") !== false) {
|
if (stripos($type, 'audio/') !== false) {
|
||||||
echo $br . "[audio]" . $url . "[/audio]" . $br;
|
echo $br . '[audio]' . $url . '[/audio]' . $br;
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$template = "[bookmark=%s]%s[/bookmark]%s";
|
$template = '[bookmark=%s]%s[/bookmark]%s';
|
||||||
|
|
||||||
$arr = ["url" => $url, "text" => ""];
|
$arr = ['url' => $url, 'text' => ''];
|
||||||
|
|
||||||
Addon::callHooks("parse_link", $arr);
|
Addon::callHooks('parse_link', $arr);
|
||||||
|
|
||||||
if (strlen($arr["text"])) {
|
if (strlen($arr['text'])) {
|
||||||
echo $arr["text"];
|
echo $arr['text'];
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is already some content information submitted we don't
|
// If there is already some content information submitted we don't
|
||||||
// need to parse the url for content.
|
// need to parse the url for content.
|
||||||
if (!empty($url) && !empty($title) && !empty($text)) {
|
if (!empty($url) && !empty($title) && !empty($text)) {
|
||||||
|
$title = str_replace(["\r", "\n"], ['', ''], $title);
|
||||||
|
|
||||||
$title = str_replace(["\r","\n"],["",""],$title);
|
$text = '[quote]' . trim($text) . '[/quote]' . $br;
|
||||||
|
|
||||||
$text = "[quote]" . trim($text) . "[/quote]" . $br;
|
|
||||||
|
|
||||||
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
|
$result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags;
|
||||||
|
|
||||||
logger("parse_url (unparsed): returns: " . $result);
|
logger('(unparsed): returns: ' . $result);
|
||||||
|
|
||||||
echo $result;
|
echo $result;
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch the information directly from the webpage
|
// Fetch the information directly from the webpage
|
||||||
$siteinfo = ParseUrl::getSiteinfo($url);
|
$siteinfo = ParseUrl::getSiteinfo($url);
|
||||||
|
|
||||||
unset($siteinfo["keywords"]);
|
unset($siteinfo['keywords']);
|
||||||
|
|
||||||
// Format it as BBCode attachment
|
// Format it as BBCode attachment
|
||||||
$info = add_page_info_data($siteinfo);
|
$info = add_page_info_data($siteinfo);
|
||||||
|
|
||||||
echo $info;
|
echo $info;
|
||||||
|
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,8 @@ function parse_url_content(App $a) {
|
||||||
* @todo Remove this function after all Addons has been changed to use
|
* @todo Remove this function after all Addons has been changed to use
|
||||||
* ParseUrl::getSiteinfoCached
|
* ParseUrl::getSiteinfoCached
|
||||||
*/
|
*/
|
||||||
function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true) {
|
function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true)
|
||||||
|
{
|
||||||
$siteinfo = ParseUrl::getSiteinfoCached($url, $no_guessing, $do_oembed);
|
$siteinfo = ParseUrl::getSiteinfoCached($url, $no_guessing, $do_oembed);
|
||||||
return $siteinfo;
|
return $siteinfo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ function photo_init(App $a)
|
||||||
// If the photo is public and there is an existing photo directory store the photo there
|
// If the photo is public and there is an existing photo directory store the photo there
|
||||||
if ($public and $file != '') {
|
if ($public and $file != '') {
|
||||||
// If the photo path isn't there, try to create it
|
// If the photo path isn't there, try to create it
|
||||||
$basepath = $a->get_basepath();
|
$basepath = $a->getBasePath();
|
||||||
if (!is_dir($basepath . "/photo")) {
|
if (!is_dir($basepath . "/photo")) {
|
||||||
if (is_writable($basepath)) {
|
if (is_writable($basepath)) {
|
||||||
mkdir($basepath . "/photo");
|
mkdir($basepath . "/photo");
|
||||||
|
|
|
@ -212,7 +212,7 @@ function photos_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the user has responded to a delete confirmation query
|
// Check if the user has responded to a delete confirmation query
|
||||||
if ($_REQUEST['canceled']) {
|
if (!empty($_REQUEST['canceled'])) {
|
||||||
goaway($_SESSION['photo_return']);
|
goaway($_SESSION['photo_return']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ function photos_post(App $a)
|
||||||
$uri = Item::newURI($page_owner_uid);
|
$uri = Item::newURI($page_owner_uid);
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uid'] = $page_owner_uid;
|
$arr['uid'] = $page_owner_uid;
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['parent-uri'] = $uri;
|
$arr['parent-uri'] = $uri;
|
||||||
|
@ -651,7 +651,7 @@ function photos_post(App $a)
|
||||||
$uri = Item::newURI($page_owner_uid);
|
$uri = Item::newURI($page_owner_uid);
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uid'] = $page_owner_uid;
|
$arr['uid'] = $page_owner_uid;
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['parent-uri'] = $uri;
|
$arr['parent-uri'] = $uri;
|
||||||
|
@ -762,12 +762,14 @@ function photos_post(App $a)
|
||||||
$filesize = $ret['filesize'];
|
$filesize = $ret['filesize'];
|
||||||
$type = $ret['type'];
|
$type = $ret['type'];
|
||||||
$error = UPLOAD_ERR_OK;
|
$error = UPLOAD_ERR_OK;
|
||||||
} else {
|
} elseif (!empty($_FILES['userfile'])) {
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
$src = $_FILES['userfile']['tmp_name'];
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
$filename = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
$type = $_FILES['userfile']['type'];
|
$type = $_FILES['userfile']['type'];
|
||||||
$error = $_FILES['userfile']['error'];
|
$error = $_FILES['userfile']['error'];
|
||||||
|
} else {
|
||||||
|
$error = UPLOAD_ERR_NO_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error !== UPLOAD_ERR_OK) {
|
if ($error !== UPLOAD_ERR_OK) {
|
||||||
|
@ -887,7 +889,7 @@ function photos_post(App $a)
|
||||||
$arr['coord'] = $lat . ' ' . $lon;
|
$arr['coord'] = $lat . ' ' . $lon;
|
||||||
}
|
}
|
||||||
|
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uid'] = $page_owner_uid;
|
$arr['uid'] = $page_owner_uid;
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['parent-uri'] = $uri;
|
$arr['parent-uri'] = $uri;
|
||||||
|
@ -1141,8 +1143,8 @@ function photos_content(App $a)
|
||||||
DBA::escape($album)
|
DBA::escape($album)
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$a->set_pager_total(count($r));
|
$a->setPagerTotal(count($r));
|
||||||
$a->set_pager_itemspage(20);
|
$a->setPagerItemsPage(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
|
/// @TODO I have seen this many times, maybe generalize it script-wide and encapsulate it?
|
||||||
|
@ -1391,7 +1393,7 @@ function photos_content(App $a)
|
||||||
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
|
$link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
|
||||||
|
|
||||||
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
|
$condition = ["`parent` = ? AND `parent` != `id`", $link_item['parent']];
|
||||||
$a->set_pager_total(DBA::count('item', $condition));
|
$a->setPagerTotal(DBA::count('item', $condition));
|
||||||
|
|
||||||
$params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
$params = ['order' => ['id'], 'limit' => [$a->pager['start'], $a->pager['itemspage']]];
|
||||||
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
|
$result = Item::selectForUser($link_item['uid'], Item::ITEM_FIELDLIST, $condition, $params);
|
||||||
|
@ -1633,7 +1635,7 @@ function photos_content(App $a)
|
||||||
'$paginate' => $paginate,
|
'$paginate' => $paginate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="photo" />' . "\n";
|
$a->page['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:image" content="' . $photo["href"] . '" />' . "\n";
|
||||||
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
|
$a->page['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
|
||||||
|
@ -1653,8 +1655,8 @@ function photos_content(App $a)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$a->set_pager_total(count($r));
|
$a->setPagerTotal(count($r));
|
||||||
$a->set_pager_itemspage(20);
|
$a->setPagerItemsPage(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
|
$r = q("SELECT `resource-id`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`filename`) AS `filename`,
|
||||||
|
|
25
mod/ping.php
25
mod/ping.php
|
@ -202,11 +202,7 @@ function ping_init(App $a)
|
||||||
$mail_count = count($mails);
|
$mail_count = count($mails);
|
||||||
|
|
||||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE && is_site_admin()) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE && is_site_admin()) {
|
||||||
$regs = q(
|
$regs = Friendica\Model\Register::getPending();
|
||||||
"SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`
|
|
||||||
FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid`
|
|
||||||
WHERE `contact`.`self` = 1"
|
|
||||||
);
|
|
||||||
|
|
||||||
if (DBA::isResult($regs)) {
|
if (DBA::isResult($regs)) {
|
||||||
$register_count = count($regs);
|
$register_count = count($regs);
|
||||||
|
@ -350,7 +346,7 @@ function ping_init(App $a)
|
||||||
$regularnotifications = (!empty($_GET['uid']) && !empty($_GET['_']));
|
$regularnotifications = (!empty($_GET['uid']) && !empty($_GET['_']));
|
||||||
|
|
||||||
foreach ($notifs as $notif) {
|
foreach ($notifs as $notif) {
|
||||||
if ($a->is_friendica_app() || !$regularnotifications) {
|
if ($a->isFriendicaApp() || !$regularnotifications) {
|
||||||
$notif['message'] = str_replace("{0}", $notif['name'], $notif['message']);
|
$notif['message'] = str_replace("{0}", $notif['name'], $notif['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,16 +506,17 @@ function ping_get_notifications($uid)
|
||||||
* @brief Backward-compatible XML formatting for ping.php output
|
* @brief Backward-compatible XML formatting for ping.php output
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*
|
*
|
||||||
* @param array $data The initial ping data array
|
* @param array $data The initial ping data array
|
||||||
* @param int $sysnotify Number of unseen system notifications
|
* @param int $sysnotify_count Number of unseen system notifications
|
||||||
* @param array $notifs Complete list of notification
|
* @param array $notifs Complete list of notification
|
||||||
* @param array $sysmsgs List of system notice messages
|
* @param array $sysmsgs List of system notice messages
|
||||||
* @param array $sysmsgs_info List of system info messages
|
* @param array $sysmsgs_info List of system info messages
|
||||||
* @param int $groups_unseen Number of unseen group items
|
* @param int $groups_unseen Number of unseen group items
|
||||||
* @param int $forums_unseen Number of unseen forum items
|
* @param int $forums_unseen Number of unseen forum items
|
||||||
|
*
|
||||||
* @return array XML-transform ready data array
|
* @return array XML-transform ready data array
|
||||||
*/
|
*/
|
||||||
function ping_format_xml_data($data, $sysnotify, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen)
|
function ping_format_xml_data($data, $sysnotify_count, $notifs, $sysmsgs, $sysmsgs_info, $groups_unseen, $forums_unseen)
|
||||||
{
|
{
|
||||||
$notifications = [];
|
$notifications = [];
|
||||||
foreach ($notifs as $key => $notif) {
|
foreach ($notifs as $key => $notif) {
|
||||||
|
|
39
mod/poke.php
39
mod/poke.php
|
@ -24,19 +24,20 @@ use Friendica\Model\Item;
|
||||||
require_once 'include/security.php';
|
require_once 'include/security.php';
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
function poke_init(App $a) {
|
function poke_init(App $a)
|
||||||
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$verb = notags(trim($_GET['verb']));
|
|
||||||
|
|
||||||
if (!$verb) {
|
if (empty($_GET['verb'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$verb = notags(trim($_GET['verb']));
|
||||||
|
|
||||||
$verbs = get_poke_verbs();
|
$verbs = get_poke_verbs();
|
||||||
|
|
||||||
if (!array_key_exists($verb, $verbs)) {
|
if (!array_key_exists($verb, $verbs)) {
|
||||||
|
@ -96,10 +97,10 @@ function poke_init(App $a) {
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uid'] = $uid;
|
$arr['uid'] = $uid;
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['parent-uri'] = ($parent_uri ? $parent_uri : $uri);
|
$arr['parent-uri'] = (!empty($parent_uri) ? $parent_uri : $uri);
|
||||||
$arr['wall'] = 1;
|
$arr['wall'] = 1;
|
||||||
$arr['contact-id'] = $poster['id'];
|
$arr['contact-id'] = $poster['id'];
|
||||||
$arr['owner-name'] = $poster['name'];
|
$arr['owner-name'] = $poster['name'];
|
||||||
|
@ -121,7 +122,7 @@ function poke_init(App $a) {
|
||||||
$arr['origin'] = 1;
|
$arr['origin'] = 1;
|
||||||
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
|
$arr['body'] = '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' . ' ' . L10n::t($verbs[$verb][0]) . ' ' . '[url=' . $target['url'] . ']' . $target['name'] . '[/url]';
|
||||||
|
|
||||||
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . System::baseUrl() . '/contact/' . $target['id'] . '</id>';
|
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $target['name'] . '</title><id>' . $target['url'] . '</id>';
|
||||||
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
|
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $target['url'] . '" />' . "\n");
|
||||||
|
|
||||||
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
|
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $target['photo'] . '" />' . "\n");
|
||||||
|
@ -137,10 +138,8 @@ function poke_init(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function poke_content(App $a)
|
||||||
|
{
|
||||||
function poke_content(App $a) {
|
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
|
@ -149,17 +148,17 @@ function poke_content(App $a) {
|
||||||
$name = '';
|
$name = '';
|
||||||
$id = '';
|
$id = '';
|
||||||
|
|
||||||
if (intval($_GET['c'])) {
|
if (empty($_GET['c'])) {
|
||||||
$r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
return;
|
||||||
intval($_GET['c']),
|
|
||||||
intval(local_user())
|
|
||||||
);
|
|
||||||
if (DBA::isResult($r)) {
|
|
||||||
$name = $item['name'];
|
|
||||||
$id = $item['id'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$contact = DBA::selectFirst('contact', ['id', 'name'], ['id' => $_GET['c'], 'uid' => local_user()]);
|
||||||
|
if (!DBA::isResult($contact)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $contact['name'];
|
||||||
|
$id = $contact['id'];
|
||||||
|
|
||||||
$base = System::baseUrl();
|
$base = System::baseUrl();
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Model\Profile;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
use Friendica\Protocol\ActivityPub;
|
||||||
|
|
||||||
function profile_init(App $a)
|
function profile_init(App $a)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +50,16 @@ function profile_init(App $a)
|
||||||
DFRN::autoRedir($a, $which);
|
DFRN::autoRedir($a, $which);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ActivityPub::isRequest()) {
|
||||||
|
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
|
||||||
|
if (DBA::isResult($user)) {
|
||||||
|
$data = ActivityPub\Transmitter::getProfile($user['uid']);
|
||||||
|
echo json_encode($data);
|
||||||
|
header('Content-Type: application/activity+json');
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Profile::load($a, $which, $profile);
|
Profile::load($a, $which, $profile);
|
||||||
|
|
||||||
$blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
|
$blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
|
||||||
|
@ -80,7 +91,7 @@ function profile_init(App $a)
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''));
|
||||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
@ -296,7 +307,7 @@ function profile_content(App $a, $update = 0)
|
||||||
$itemspage_network = $a->force_max_items;
|
$itemspage_network = $a->force_max_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_pager_itemspage($itemspage_network);
|
$a->setPagerItemsPage($itemspage_network);
|
||||||
|
|
||||||
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
$pager_sql = sprintf(" LIMIT %d, %d ", intval($a->pager['start']), intval($a->pager['itemspage']));
|
||||||
|
|
||||||
|
|
|
@ -317,7 +317,6 @@ function profile_photo_crop_ui_head(App $a, Image $image)
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
|
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
|
||||||
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), []);
|
|
||||||
|
|
||||||
$imagecrop = [
|
$imagecrop = [
|
||||||
'hash' => $hash,
|
'hash' => $hash,
|
||||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
function profiles_init(App $a) {
|
function profiles_init(App $a) {
|
||||||
|
|
||||||
|
@ -509,7 +510,7 @@ function profiles_content(App $a) {
|
||||||
|
|
||||||
if (! local_user()) {
|
if (! local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
@ -527,9 +528,6 @@ function profiles_content(App $a) {
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), [
|
$a->page['htmlhead'] .= replace_macros(get_markup_template('profed_head.tpl'), [
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
]);
|
]);
|
||||||
$a->page['end'] .= replace_macros(get_markup_template('profed_end.tpl'), [
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
]);
|
|
||||||
|
|
||||||
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
|
$opt_tpl = get_markup_template("profile-hide-friends.tpl");
|
||||||
$hide_friends = replace_macros($opt_tpl,[
|
$hide_friends = replace_macros($opt_tpl,[
|
||||||
|
@ -618,10 +616,10 @@ function profiles_content(App $a) {
|
||||||
'$country_name' => ['country_name', L10n::t('Country:'), $r[0]['country-name']],
|
'$country_name' => ['country_name', L10n::t('Country:'), $r[0]['country-name']],
|
||||||
'$age' => ((intval($r[0]['dob'])) ? '(' . L10n::t('Age: ') . Temporal::getAgeByTimezone($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
|
'$age' => ((intval($r[0]['dob'])) ? '(' . L10n::t('Age: ') . Temporal::getAgeByTimezone($r[0]['dob'],$a->user['timezone'],$a->user['timezone']) . ')' : ''),
|
||||||
'$gender' => ContactSelector::gender($r[0]['gender']),
|
'$gender' => ContactSelector::gender($r[0]['gender']),
|
||||||
'$marital' => ContactSelector::maritalStatus($r[0]['marital']),
|
'$marital' => ['selector' => ContactSelector::maritalStatus($r[0]['marital']), 'value' => $r[0]['marital']],
|
||||||
'$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
|
'$with' => ['with', L10n::t("Who: \x28if applicable\x29"), strip_tags($r[0]['with']), L10n::t('Examples: cathy123, Cathy Williams, cathy@example.com')],
|
||||||
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : DateTimeFormat::local($r[0]['howlong']))],
|
'$howlong' => ['howlong', L10n::t('Since [date]:'), ($r[0]['howlong'] <= NULL_DATE ? '' : DateTimeFormat::local($r[0]['howlong']))],
|
||||||
'$sexual' => ContactSelector::sexualPreference($r[0]['sexual']),
|
'$sexual' => ['selector' => ContactSelector::sexualPreference($r[0]['sexual']), 'value' => $r[0]['sexual']],
|
||||||
'$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']],
|
'$about' => ['about', L10n::t('Tell us about yourself...'), $r[0]['about']],
|
||||||
'$xmpp' => ['xmpp', L10n::t("XMPP \x28Jabber\x29 address:"), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")],
|
'$xmpp' => ['xmpp', L10n::t("XMPP \x28Jabber\x29 address:"), $r[0]['xmpp'], L10n::t("The XMPP address will be propagated to your contacts so that they can follow you.")],
|
||||||
'$homepage' => ['homepage', L10n::t('Homepage URL:'), $r[0]['homepage']],
|
'$homepage' => ['homepage', L10n::t('Homepage URL:'), $r[0]['homepage']],
|
||||||
|
@ -669,7 +667,7 @@ function profiles_content(App $a) {
|
||||||
$profiles = '';
|
$profiles = '';
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$profiles .= replace_macros($tpl, [
|
$profiles .= replace_macros($tpl, [
|
||||||
'$photo' => $a->remove_baseurl($rr['thumb']),
|
'$photo' => $a->removeBaseURL($rr['thumb']),
|
||||||
'$id' => $rr['id'],
|
'$id' => $rr['id'],
|
||||||
'$alt' => L10n::t('Profile Image'),
|
'$alt' => L10n::t('Profile Image'),
|
||||||
'$profile_name' => $rr['profile-name'],
|
'$profile_name' => $rr['profile-name'],
|
||||||
|
|
|
@ -104,8 +104,9 @@ function pubsubhubbub_init(App $a) {
|
||||||
// we don't actually enforce the lease time because GNU
|
// we don't actually enforce the lease time because GNU
|
||||||
// Social/StatusNet doesn't honour it (yet)
|
// Social/StatusNet doesn't honour it (yet)
|
||||||
|
|
||||||
$body = Network::fetchUrl($hub_callback . "?" . $params);
|
$fetchResult = Network::fetchUrlFull($hub_callback . "?" . $params);
|
||||||
$ret = $a->get_curl_code();
|
$body = $fetchResult->getBody();
|
||||||
|
$ret = $fetchResult->getReturnCode();
|
||||||
|
|
||||||
// give up if the HTTP return code wasn't a success (2xx)
|
// give up if the HTTP return code wasn't a success (2xx)
|
||||||
if ($ret < 200 || $ret > 299) {
|
if ($ret < 200 || $ret > 299) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ function redir_init(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remote_user()) {
|
if (remote_user()) {
|
||||||
$host = substr(System::baseUrl() . ($a->urlpath ? '/' . $a->urlpath : ''), strpos(System::baseUrl(), '://') + 3);
|
$host = substr(System::baseUrl() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''), strpos(System::baseUrl(), '://') + 3);
|
||||||
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
|
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
|
||||||
|
|
||||||
// On a local instance we have to check if the local user has already authenticated
|
// On a local instance we have to check if the local user has already authenticated
|
||||||
|
|
|
@ -11,10 +11,8 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Model;
|
||||||
use Friendica\Model\User;
|
|
||||||
use Friendica\Module\Tos;
|
use Friendica\Module\Tos;
|
||||||
use Friendica\Util\DateTimeFormat;
|
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
|
||||||
|
@ -67,7 +65,7 @@ function register_post(App $a)
|
||||||
$arr['language'] = L10n::getBrowserLanguage();
|
$arr['language'] = L10n::getBrowserLanguage();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = User::create($arr);
|
$result = Model\User::create($arr);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
notice($e->getMessage());
|
notice($e->getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -76,7 +74,7 @@ function register_post(App $a)
|
||||||
$user = $result['user'];
|
$user = $result['user'];
|
||||||
|
|
||||||
if ($netpublish && intval(Config::get('config', 'register_policy')) !== REGISTER_APPROVE) {
|
if ($netpublish && intval(Config::get('config', 'register_policy')) !== REGISTER_APPROVE) {
|
||||||
$url = System::baseUrl() . '/profile/' . $user['nickname'];
|
$url = $a->getBaseUrl() . '/profile/' . $user['nickname'];
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,18 +84,22 @@ function register_post(App $a)
|
||||||
|
|
||||||
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN) {
|
||||||
if ($using_invites && $invite_id) {
|
if ($using_invites && $invite_id) {
|
||||||
q("delete * from register where hash = '%s' limit 1", DBA::escape($invite_id));
|
Model\Register::deleteByHash($invite_id);
|
||||||
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only send a password mail when the password wasn't manually provided
|
// Only send a password mail when the password wasn't manually provided
|
||||||
if (!x($_POST, 'password1') || !x($_POST, 'confirm')) {
|
if (!x($_POST, 'password1') || !x($_POST, 'confirm')) {
|
||||||
$res = User::sendRegisterOpenEmail(
|
$res = Model\User::sendRegisterOpenEmail(
|
||||||
$user['email'], Config::get('config', 'sitename'), System::baseUrl(), $user['username'], $result['password'], $user);
|
$user,
|
||||||
|
Config::get('config', 'sitename'),
|
||||||
|
$a->getBaseUrl(),
|
||||||
|
$result['password']
|
||||||
|
);
|
||||||
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway();
|
||||||
} else {
|
} else {
|
||||||
notice(
|
notice(
|
||||||
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
L10n::t('Failed to send email message. Here your accout details:<br> login: %s<br> password: %s<br><br>You can change your password after login.',
|
||||||
|
@ -108,27 +110,19 @@ function register_post(App $a)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info(L10n::t('Registration successful.') . EOL);
|
info(L10n::t('Registration successful.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway();
|
||||||
}
|
}
|
||||||
} elseif (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE) {
|
} elseif (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE) {
|
||||||
if (!strlen(Config::get('config', 'admin_email'))) {
|
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||||
notice(L10n::t('Your registration can not be processed.') . EOL);
|
notice(L10n::t('Your registration can not be processed.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway();
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = random_string();
|
Model\Register::createForApproval($user['uid'], Config::get('system', 'language'), $_POST['permonlybox']);
|
||||||
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language`, `note` ) VALUES ( '%s', '%s', %d, '%s', '%s', '%s' ) ",
|
|
||||||
DBA::escape($hash),
|
|
||||||
DBA::escape(DateTimeFormat::utcNow()),
|
|
||||||
intval($user['uid']),
|
|
||||||
DBA::escape($result['password']),
|
|
||||||
DBA::escape(Config::get('system', 'language')),
|
|
||||||
DBA::escape($_POST['permonlybox'])
|
|
||||||
);
|
|
||||||
|
|
||||||
// invite system
|
// invite system
|
||||||
if ($using_invites && $invite_id) {
|
if ($using_invites && $invite_id) {
|
||||||
q("DELETE * FROM `register` WHERE `hash` = '%s' LIMIT 1", DBA::escape($invite_id));
|
Model\Register::deleteByHash($invite_id);
|
||||||
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,9 +140,9 @@ function register_post(App $a)
|
||||||
'source_name' => $user['username'],
|
'source_name' => $user['username'],
|
||||||
'source_mail' => $user['email'],
|
'source_mail' => $user['email'],
|
||||||
'source_nick' => $user['nickname'],
|
'source_nick' => $user['nickname'],
|
||||||
'source_link' => System::baseUrl() . "/admin/users/",
|
'source_link' => $a->getBaseUrl() . "/admin/users/",
|
||||||
'link' => System::baseUrl() . "/admin/users/",
|
'link' => $a->getBaseUrl() . "/admin/users/",
|
||||||
'source_photo' => System::baseUrl() . "/photo/avatar/" . $user['uid'] . ".jpg",
|
'source_photo' => $a->getBaseUrl() . "/photo/avatar/" . $user['uid'] . ".jpg",
|
||||||
'to_email' => $admin['email'],
|
'to_email' => $admin['email'],
|
||||||
'uid' => $admin['uid'],
|
'uid' => $admin['uid'],
|
||||||
'language' => $admin['language'] ? $admin['language'] : 'en',
|
'language' => $admin['language'] ? $admin['language'] : 'en',
|
||||||
|
@ -156,11 +150,15 @@ function register_post(App $a)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
// send notification to the user, that the registration is pending
|
// send notification to the user, that the registration is pending
|
||||||
User::sendRegisterPendingEmail(
|
Model\User::sendRegisterPendingEmail(
|
||||||
$user['email'], Config::get('config', 'sitename'), $user['username']);
|
$user,
|
||||||
|
Config::get('config', 'sitename'),
|
||||||
|
$a->getBaseURL(),
|
||||||
|
$result['password']
|
||||||
|
);
|
||||||
|
|
||||||
info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway();
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -274,7 +272,7 @@ function register_content(App $a)
|
||||||
'$passwords' => $passwords,
|
'$passwords' => $passwords,
|
||||||
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
|
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
|
||||||
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
|
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
|
||||||
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->get_hostname()),
|
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be \'<strong>nickname@%s</strong>\'.', $a->getHostName()),
|
||||||
'$nicklabel' => L10n::t('Choose a nickname: '),
|
'$nicklabel' => L10n::t('Choose a nickname: '),
|
||||||
'$photo' => $photo,
|
'$photo' => $photo,
|
||||||
'$publish' => $profile_publish,
|
'$publish' => $profile_publish,
|
||||||
|
@ -283,7 +281,7 @@ function register_content(App $a)
|
||||||
'$email' => $email,
|
'$email' => $email,
|
||||||
'$nickname' => $nickname,
|
'$nickname' => $nickname,
|
||||||
'$license' => $license,
|
'$license' => $license,
|
||||||
'$sitename' => $a->get_hostname(),
|
'$sitename' => $a->getHostName(),
|
||||||
'$importh' => L10n::t('Import'),
|
'$importh' => L10n::t('Import'),
|
||||||
'$importt' => L10n::t('Import your profile to this friendica instance'),
|
'$importt' => L10n::t('Import your profile to this friendica instance'),
|
||||||
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Model\Register;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
|
@ -18,51 +19,35 @@ function user_allow($hash)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
$register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
|
$register = Register::getByHash($hash);
|
||||||
DBA::escape($hash)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
if (!DBA::isResult($register)) {
|
if (!DBA::isResult($register)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
$user = User::getById($register['uid']);
|
||||||
intval($register[0]['uid'])
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!DBA::isResult($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("DELETE FROM `register` WHERE `hash` = '%s'",
|
Register::deleteByHash($hash);
|
||||||
DBA::escape($register[0]['hash'])
|
|
||||||
);
|
|
||||||
|
|
||||||
|
DBA::update('user', ['blocked' => false, 'verified' => true], ['uid' => $register['uid']]);
|
||||||
|
|
||||||
$r = q("UPDATE `user` SET `blocked` = 0, `verified` = 1 WHERE `uid` = %d",
|
$profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
|
||||||
intval($register[0]['uid'])
|
|
||||||
);
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default` = 1",
|
if (DBA::isResult($profile) && $profile['net-publish'] && Config::get('system', 'directory')) {
|
||||||
intval($user[0]['uid'])
|
$url = System::baseUrl() . '/profile/' . $user['nickname'];
|
||||||
);
|
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||||
if (DBA::isResult($r) && $r[0]['net-publish']) {
|
|
||||||
$url = System::baseUrl() . '/profile/' . $user[0]['nickname'];
|
|
||||||
if ($url && strlen(Config::get('system', 'directory'))) {
|
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
L10n::pushLang($register[0]['language']);
|
L10n::pushLang($register['language']);
|
||||||
|
|
||||||
$res = User::sendRegisterOpenEmail(
|
$res = User::sendRegisterOpenEmail(
|
||||||
$user[0]['email'],
|
$user,
|
||||||
Config::get('config', 'sitename'),
|
Config::get('config', 'sitename'),
|
||||||
System::baseUrl(),
|
$a->getBaseUrl(),
|
||||||
$user[0]['username'],
|
defaults($register, 'password', 'Sent in a previous email')
|
||||||
$register[0]['password'],
|
);
|
||||||
$user[0]);
|
|
||||||
|
|
||||||
L10n::popLang();
|
L10n::popLang();
|
||||||
|
|
||||||
|
@ -77,22 +62,21 @@ function user_allow($hash)
|
||||||
// allowed to have friends on this system
|
// allowed to have friends on this system
|
||||||
function user_deny($hash)
|
function user_deny($hash)
|
||||||
{
|
{
|
||||||
$register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
|
$register = Register::getByHash($hash);
|
||||||
DBA::escape($hash)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!DBA::isResult($register)) {
|
if (!DBA::isResult($register)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
|
$user = User::getById($register['uid']);
|
||||||
intval($register[0]['uid'])
|
if (!DBA::isResult($user)) {
|
||||||
);
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
DBA::delete('user', ['uid' => $register[0]['uid']]);
|
DBA::delete('user', ['uid' => $register['uid']]);
|
||||||
DBA::delete('register', ['hash' => $register[0]['hash']]);
|
|
||||||
|
|
||||||
notice(L10n::t('Registration revoked for %s', $user[0]['username']) . EOL);
|
Register::deleteByHash($register['hash']);
|
||||||
|
|
||||||
|
notice(L10n::t('Registration revoked for %s', $user['username']) . EOL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,17 +84,16 @@ function regmod_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
info(L10n::t('Please login.') . EOL);
|
info(L10n::t('Please login.') . EOL);
|
||||||
$o = '<br /><br />' . Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
return Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||||
return $o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!is_site_admin()) || (x($_SESSION, 'submanage') && intval($_SESSION['submanage']))) {
|
if (!is_site_admin() || !empty($_SESSION['submanage'])) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc != 3) {
|
if ($a->argc != 3) {
|
||||||
killme();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cmd = $a->argv[1];
|
$cmd = $a->argv[1];
|
||||||
|
@ -118,13 +101,11 @@ function regmod_content(App $a)
|
||||||
|
|
||||||
if ($cmd === 'deny') {
|
if ($cmd === 'deny') {
|
||||||
user_deny($hash);
|
user_deny($hash);
|
||||||
goaway(System::baseUrl() . "/admin/users/");
|
goaway('admin/users/');
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cmd === 'allow') {
|
if ($cmd === 'allow') {
|
||||||
user_allow($hash);
|
user_allow($hash);
|
||||||
goaway(System::baseUrl() . "/admin/users/");
|
goaway('admin/users/');
|
||||||
killme();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ function repair_ostatus_content(App $a) {
|
||||||
|
|
||||||
if (! local_user()) {
|
if (! local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
goaway($_SESSION['return_url']);
|
goaway('/ostatus_repair');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,14 +41,14 @@ function salmon_post(App $a, $xml = '') {
|
||||||
$base = null;
|
$base = null;
|
||||||
|
|
||||||
// figure out where in the DOM tree our data is hiding
|
// figure out where in the DOM tree our data is hiding
|
||||||
if($dom->provenance->data)
|
if (!empty($dom->provenance->data))
|
||||||
$base = $dom->provenance;
|
$base = $dom->provenance;
|
||||||
elseif($dom->env->data)
|
elseif (!empty($dom->env->data))
|
||||||
$base = $dom->env;
|
$base = $dom->env;
|
||||||
elseif($dom->data)
|
elseif (!empty($dom->data))
|
||||||
$base = $dom;
|
$base = $dom;
|
||||||
|
|
||||||
if(! $base) {
|
if (empty($base)) {
|
||||||
logger('unable to locate salmon data in xml ');
|
logger('unable to locate salmon data in xml ');
|
||||||
System::httpExit(400);
|
System::httpExit(400);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\Temporal;
|
use Friendica\Util\Temporal;
|
||||||
|
use Friendica\Module\Login;
|
||||||
|
|
||||||
function get_theme_config_file($theme)
|
function get_theme_config_file($theme)
|
||||||
{
|
{
|
||||||
|
@ -546,7 +547,7 @@ function settings_post(App $a)
|
||||||
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
|
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
|
||||||
if (Network::isUrlValid($openid)) {
|
if (Network::isUrlValid($openid)) {
|
||||||
logger('updating openidserver');
|
logger('updating openidserver');
|
||||||
$open_id_obj = new LightOpenID($a->get_hostname());
|
$open_id_obj = new LightOpenID($a->getHostName());
|
||||||
$open_id_obj->identity = $openid;
|
$open_id_obj->identity = $openid;
|
||||||
$openidserver = $open_id_obj->discover($open_id_obj->identity);
|
$openidserver = $open_id_obj->discover($open_id_obj->identity);
|
||||||
} else {
|
} else {
|
||||||
|
@ -658,7 +659,7 @@ function settings_content(App $a)
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
//notice(L10n::t('Permission denied.') . EOL);
|
//notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return Login::form();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
|
if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
|
||||||
|
@ -982,11 +983,6 @@ function settings_content(App $a)
|
||||||
'$theme_config' => $theme_config,
|
'$theme_config' => $theme_config,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('settings/display_end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes]
|
|
||||||
]);
|
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1140,8 +1136,8 @@ function settings_content(App $a)
|
||||||
$tpl_addr = get_markup_template('settings/nick_set.tpl');
|
$tpl_addr = get_markup_template('settings/nick_set.tpl');
|
||||||
|
|
||||||
$prof_addr = replace_macros($tpl_addr,[
|
$prof_addr = replace_macros($tpl_addr,[
|
||||||
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname),
|
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
|
||||||
'$basepath' => $a->get_hostname()
|
'$basepath' => $a->getHostName()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$stpl = get_markup_template('settings/settings.tpl');
|
$stpl = get_markup_template('settings/settings.tpl');
|
||||||
|
|
|
@ -108,7 +108,7 @@ EOT;
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['uid'] = $owner_uid;
|
$arr['uid'] = $owner_uid;
|
||||||
$arr['contact-id'] = $contact['id'];
|
$arr['contact-id'] = $contact['id'];
|
||||||
|
|
|
@ -115,7 +115,7 @@ EOT;
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
|
||||||
$arr['guid'] = System::createGUID(32);
|
$arr['guid'] = System::createUUID();
|
||||||
$arr['uri'] = $uri;
|
$arr['uri'] = $uri;
|
||||||
$arr['uid'] = $owner_uid;
|
$arr['uid'] = $owner_uid;
|
||||||
$arr['contact-id'] = $contact['id'];
|
$arr['contact-id'] = $contact['id'];
|
||||||
|
|
168
mod/unfollow.php
168
mod/unfollow.php
|
@ -10,132 +10,144 @@ use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
use Friendica\Model\User;
|
||||||
|
|
||||||
function unfollow_post(App $a)
|
function unfollow_post()
|
||||||
{
|
{
|
||||||
|
$return_url = 'contacts';
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway('/login');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['cancel']) {
|
|
||||||
goaway($_SESSION['return_url']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$url = notags(trim($_REQUEST['url']));
|
$url = notags(trim(defaults($_REQUEST, 'url', '')));
|
||||||
$return_url = $_SESSION['return_url'];
|
|
||||||
|
|
||||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||||
$uid, Contact::FRIEND, normalise_link($url),
|
$uid, Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
normalise_link($url), $url, Protocol::STATUSNET];
|
normalise_link($url), $url];
|
||||||
$contact = DBA::selectFirst('contact', [], $condition);
|
$contact = DBA::selectFirst('contact', [], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
notice(L10n::t("Contact wasn't found or can't be unfollowed."));
|
notice(L10n::t("You aren't following this contact."));
|
||||||
} else {
|
goaway($return_url);
|
||||||
if (in_array($contact['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN])) {
|
// NOTREACHED
|
||||||
$r = q("SELECT `contact`.*, `user`.* FROM `contact` INNER JOIN `user` ON `contact`.`uid` = `user`.`uid`
|
|
||||||
WHERE `user`.`uid` = %d AND `contact`.`self` LIMIT 1",
|
|
||||||
intval($uid)
|
|
||||||
);
|
|
||||||
if (DBA::isResult($r)) {
|
|
||||||
Contact::terminateFriendship($r[0], $contact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
|
|
||||||
|
|
||||||
info(L10n::t('Contact unfollowed').EOL);
|
|
||||||
goaway(System::baseUrl().'/contacts/'.$contact['id']);
|
|
||||||
}
|
}
|
||||||
goaway($return_url);
|
|
||||||
|
if (!empty($_REQUEST['cancel'])) {
|
||||||
|
goaway($return_url . '/' . $contact['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||||
|
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||||
|
goaway($return_url . '/' . $contact['id']);
|
||||||
|
// NOTREACHED
|
||||||
|
}
|
||||||
|
|
||||||
|
$dissolve = ($contact['rel'] == Contact::SHARING);
|
||||||
|
|
||||||
|
$owner = User::getOwnerDataById($uid);
|
||||||
|
if ($owner) {
|
||||||
|
Contact::terminateFriendship($owner, $contact, $dissolve);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sharing-only contacts get deleted as there no relationship any more
|
||||||
|
if ($dissolve) {
|
||||||
|
Contact::remove($contact['id']);
|
||||||
|
$return_path = 'contacts';
|
||||||
|
} else {
|
||||||
|
DBA::update('contact', ['rel' => Contact::FOLLOWER], ['id' => $contact['id']]);
|
||||||
|
$return_path = 'contact/' . $contact['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
info(L10n::t('Contact unfollowed'));
|
||||||
|
goaway($return_path);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
function unfollow_content(App $a)
|
function unfollow_content(App $a)
|
||||||
{
|
{
|
||||||
if (! local_user()) {
|
$return_url = 'contacts';
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
|
||||||
goaway($_SESSION['return_url']);
|
if (!local_user()) {
|
||||||
|
notice(L10n::t('Permission denied.'));
|
||||||
|
goaway('/login');
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = local_user();
|
$uid = local_user();
|
||||||
$url = notags(trim($_REQUEST['url']));
|
$url = notags(trim($_REQUEST['url']));
|
||||||
|
|
||||||
$submit = L10n::t('Submit Request');
|
$condition = ["`uid` = ? AND (`rel` = ? OR `rel` = ?) AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)",
|
||||||
|
local_user(), Contact::SHARING, Contact::FRIEND, normalise_link($url),
|
||||||
$condition = ["`uid` = ? AND `rel` = ? AND (`nurl` = ? OR `alias` = ? OR `alias` = ?) AND `network` != ?",
|
normalise_link($url), $url];
|
||||||
local_user(), Contact::FRIEND, normalise_link($url),
|
|
||||||
normalise_link($url), $url, Protocol::STATUSNET];
|
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
$contact = DBA::selectFirst('contact', ['url', 'network', 'addr', 'name'], $condition);
|
||||||
|
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::isResult($contact)) {
|
||||||
notice(L10n::t("You aren't a friend of this contact.").EOL);
|
notice(L10n::t("You aren't following this contact."));
|
||||||
$submit = "";
|
goaway($return_url);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($contact['network'], [Protocol::DIASPORA, Protocol::OSTATUS, Protocol::DFRN])) {
|
if (!in_array($contact['network'], Protocol::NATIVE_SUPPORT)) {
|
||||||
notice(L10n::t("Unfollowing is currently not supported by your network.").EOL);
|
notice(L10n::t('Unfollowing is currently not supported by your network.'));
|
||||||
$submit = "";
|
goaway('contact/' . $contact['id']);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = System::baseUrl()."/unfollow";
|
$request = System::baseUrl() . '/unfollow';
|
||||||
$tpl = get_markup_template('auto_request.tpl');
|
$tpl = get_markup_template('auto_request.tpl');
|
||||||
|
|
||||||
$r = q("SELECT `url` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($uid));
|
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
|
||||||
|
|
||||||
if (!$r) {
|
if (!DBA::isResult($self)) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.'));
|
||||||
goaway($_SESSION['return_url']);
|
goaway($return_url);
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$myaddr = $r[0]["url"];
|
|
||||||
|
|
||||||
// Makes the connection request for friendica contacts easier
|
// Makes the connection request for friendica contacts easier
|
||||||
$_SESSION["fastlane"] = $contact["url"];
|
$_SESSION['fastlane'] = $contact['url'];
|
||||||
|
|
||||||
$header = L10n::t("Disconnect/Unfollow");
|
$header = L10n::t('Disconnect/Unfollow');
|
||||||
|
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$header' => htmlentities($header),
|
'$header' => htmlentities($header),
|
||||||
'$desc' => "",
|
'$desc' => '',
|
||||||
'$pls_answer' => "",
|
'$pls_answer' => '',
|
||||||
'$does_know_you' => "",
|
'$does_know_you' => '',
|
||||||
'$add_note' => "",
|
'$add_note' => '',
|
||||||
'$page_desc' => "",
|
'$page_desc' => '',
|
||||||
'$friendica' => "",
|
'$friendica' => '',
|
||||||
'$statusnet' => "",
|
'$statusnet' => '',
|
||||||
'$diaspora' => "",
|
'$diaspora' => '',
|
||||||
'$diasnote' => "",
|
'$diasnote' => '',
|
||||||
'$your_address' => L10n::t('Your Identity Address:'),
|
'$your_address' => L10n::t('Your Identity Address:'),
|
||||||
'$invite_desc' => "",
|
'$invite_desc' => '',
|
||||||
'$emailnet' => "",
|
'$emailnet' => '',
|
||||||
'$submit' => $submit,
|
'$submit' => L10n::t('Submit Request'),
|
||||||
'$cancel' => L10n::t('Cancel'),
|
'$cancel' => L10n::t('Cancel'),
|
||||||
'$nickname' => "",
|
'$nickname' => '',
|
||||||
'$name' => $contact["name"],
|
'$name' => $contact['name'],
|
||||||
'$url' => $contact["url"],
|
'$url' => $contact['url'],
|
||||||
'$zrl' => Contact::magicLink($contact["url"]),
|
'$zrl' => Contact::magicLink($contact['url']),
|
||||||
'$url_label' => L10n::t("Profile URL"),
|
'$url_label' => L10n::t('Profile URL'),
|
||||||
'$myaddr' => $myaddr,
|
'$myaddr' => $self['url'],
|
||||||
'$request' => $request,
|
'$request' => $request,
|
||||||
'$keywords' => "",
|
'$keywords' => '',
|
||||||
'$keywords_label' => ""
|
'$keywords_label'=> ''
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = '';
|
||||||
Profile::load($a, "", 0, Contact::getDetailsByURL($contact["url"]));
|
Profile::load($a, '', 0, Contact::getDetailsByURL($contact['url']));
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
$o .= replace_macros(get_markup_template('section_title.tpl'), ['$title' => L10n::t('Status Messages and Posts')]);
|
||||||
|
|
||||||
// Show last public posts
|
// Show last public posts
|
||||||
$o .= Contact::getPostsFromUrl($contact["url"]);
|
$o .= Contact::getPostsFromUrl($contact['url']);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
38
mod/update_contacts.php
Normal file
38
mod/update_contacts.php
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// See update_profile.php for documentation
|
||||||
|
|
||||||
|
use Friendica\App;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Core\PConfig;
|
||||||
|
use Friendica\Module\Contact;
|
||||||
|
|
||||||
|
function update_contacts_content(App $a)
|
||||||
|
{
|
||||||
|
header("Content-type: text/html");
|
||||||
|
echo "<!DOCTYPE html><html><body>\r\n";
|
||||||
|
echo "<section>";
|
||||||
|
|
||||||
|
if ($_GET["force"] == 1) {
|
||||||
|
$text = Contact::content($a, true);
|
||||||
|
} else {
|
||||||
|
$text = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PConfig::get(local_user(), "system", "bandwidth_saver")) {
|
||||||
|
$replace = "<br />".L10n::t("[Embedded content - reload page to view]")."<br />";
|
||||||
|
$pattern = "/<\s*audio[^>]*>(.*?)<\s*\/\s*audio>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
$pattern = "/<\s*video[^>]*>(.*?)<\s*\/\s*video>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
$pattern = "/<\s*embed[^>]*>(.*?)<\s*\/\s*embed>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
$pattern = "/<\s*iframe[^>]*>(.*?)<\s*\/\s*iframe>/i";
|
||||||
|
$text = preg_replace($pattern, $replace, $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo str_replace("\t", " ", $text);
|
||||||
|
echo "</section>";
|
||||||
|
echo "</body></html>\r\n";
|
||||||
|
killme();
|
||||||
|
}
|
|
@ -105,12 +105,6 @@ function videos_init(App $a)
|
||||||
$a->page['htmlhead'] .= replace_macros($tpl,[
|
$a->page['htmlhead'] .= replace_macros($tpl,[
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => System::baseUrl(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template("videos_end.tpl");
|
|
||||||
$a->page['end'] .= replace_macros($tpl,[
|
|
||||||
'$baseurl' => System::baseUrl(),
|
|
||||||
]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -347,8 +341,8 @@ function videos_content(App $a)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$a->set_pager_total(count($r));
|
$a->setPagerTotal(count($r));
|
||||||
$a->set_pager_itemspage(20);
|
$a->setPagerItemsPage(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
|
$r = q("SELECT hash, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`created`) AS `created`,
|
||||||
|
@ -367,11 +361,12 @@ function videos_content(App $a)
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$alt_e = $rr['filename'];
|
$alt_e = $rr['filename'];
|
||||||
/// @todo The album isn't part of the above query. This seems to be some unfinished code that needs to be reworked completely.
|
/// @todo The album isn't part of the above query. This seems to be some unfinished code that needs to be reworked completely.
|
||||||
|
$rr['album'] = '';
|
||||||
$name_e = $rr['album'];
|
$name_e = $rr['album'];
|
||||||
|
|
||||||
$videos[] = [
|
$videos[] = [
|
||||||
'id' => $rr['id'],
|
'id' => $rr['id'],
|
||||||
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['resource-id'],
|
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['hash'],
|
||||||
'title' => L10n::t('View Video'),
|
'title' => L10n::t('View Video'),
|
||||||
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
|
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
|
||||||
'alt' => $alt_e,
|
'alt' => $alt_e,
|
||||||
|
|
|
@ -71,7 +71,7 @@ function viewcontacts_content(App $a)
|
||||||
DBA::escape(Protocol::OSTATUS)
|
DBA::escape(Protocol::OSTATUS)
|
||||||
);
|
);
|
||||||
if (DBA::isResult($r)) {
|
if (DBA::isResult($r)) {
|
||||||
$a->set_pager_total($r[0]['total']);
|
$a->setPagerTotal($r[0]['total']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact`
|
$r = q("SELECT * FROM `contact`
|
||||||
|
|
|
@ -26,7 +26,7 @@ function viewsrc_content(App $a)
|
||||||
$item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
|
$item = Item::selectFirst(['body'], ['uid' => local_user(), 'id' => $item_id]);
|
||||||
|
|
||||||
if (DBA::isResult($item)) {
|
if (DBA::isResult($item)) {
|
||||||
if (is_ajax()) {
|
if ($a->isAjax()) {
|
||||||
echo str_replace("\n", '<br />', $item['body']);
|
echo str_replace("\n", '<br />', $item['body']);
|
||||||
killme();
|
killme();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -120,13 +120,6 @@ function wallmessage_content(App $a) {
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
'$linkurl' => L10n::t('Please enter a link URL:')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$tpl = get_markup_template('wallmsg-end.tpl');
|
|
||||||
$a->page['end'] .= replace_macros($tpl, [
|
|
||||||
'$baseurl' => System::baseUrl(true),
|
|
||||||
'$nickname' => $user['nickname'],
|
|
||||||
'$linkurl' => L10n::t('Please enter a link URL:')
|
|
||||||
]);
|
|
||||||
|
|
||||||
$tpl = get_markup_template('wallmessage.tpl');
|
$tpl = get_markup_template('wallmessage.tpl');
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$header' => L10n::t('Send Private Message'),
|
'$header' => L10n::t('Send Private Message'),
|
||||||
|
|
|
@ -23,7 +23,7 @@ function webfinger_content(App $a)
|
||||||
$o = '<h3>Webfinger Diagnostic</h3>';
|
$o = '<h3>Webfinger Diagnostic</h3>';
|
||||||
|
|
||||||
$o .= '<form action="webfinger" method="get">';
|
$o .= '<form action="webfinger" method="get">';
|
||||||
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
|
$o .= 'Lookup address: <input type="text" style="width: 250px;" name="addr" value="' . defaults($_GET, 'addr', '') .'" />';
|
||||||
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||||
|
|
||||||
$o .= '<br /><br />';
|
$o .= '<br /><br />';
|
||||||
|
|
14
mod/xrd.php
14
mod/xrd.php
|
@ -13,7 +13,7 @@ function xrd_init(App $a)
|
||||||
{
|
{
|
||||||
if ($a->argv[0] == 'xrd') {
|
if ($a->argv[0] == 'xrd') {
|
||||||
if (empty($_GET['uri'])) {
|
if (empty($_GET['uri'])) {
|
||||||
killme();
|
System::httpExit(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = urldecode(notags(trim($_GET['uri'])));
|
$uri = urldecode(notags(trim($_GET['uri'])));
|
||||||
|
@ -24,7 +24,7 @@ function xrd_init(App $a)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (empty($_GET['resource'])) {
|
if (empty($_GET['resource'])) {
|
||||||
killme();
|
System::httpExit(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri = urldecode(notags(trim($_GET['resource'])));
|
$uri = urldecode(notags(trim($_GET['resource'])));
|
||||||
|
@ -48,16 +48,16 @@ function xrd_init(App $a)
|
||||||
|
|
||||||
$user = DBA::selectFirst('user', [], ['nickname' => $name]);
|
$user = DBA::selectFirst('user', [], ['nickname' => $name]);
|
||||||
if (!DBA::isResult($user)) {
|
if (!DBA::isResult($user)) {
|
||||||
killme();
|
System::httpExit(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile_url = System::baseUrl().'/profile/'.$user['nickname'];
|
$profile_url = System::baseUrl().'/profile/'.$user['nickname'];
|
||||||
|
|
||||||
$alias = str_replace('/profile/', '/~', $profile_url);
|
$alias = str_replace('/profile/', '/~', $profile_url);
|
||||||
|
|
||||||
$addr = 'acct:'.$user['nickname'].'@'.$a->get_hostname();
|
$addr = 'acct:'.$user['nickname'].'@'.$a->getHostName();
|
||||||
if ($a->get_path()) {
|
if ($a->getURLPath()) {
|
||||||
$addr .= '/'.$a->get_path();
|
$addr .= '/'.$a->getURLPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($mode == 'xml') {
|
if ($mode == 'xml') {
|
||||||
|
@ -80,6 +80,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
|
||||||
['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
|
['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
|
||||||
['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
|
['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
|
||||||
['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
|
['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
|
||||||
|
['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url],
|
||||||
['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
|
['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
|
||||||
['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
|
['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
|
||||||
['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
|
['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
|
||||||
|
@ -92,6 +93,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
|
||||||
['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
|
['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
echo json_encode($json);
|
echo json_encode($json);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
605
src/App.php
605
src/App.php
File diff suppressed because it is too large
Load diff
117
src/App/Mode.php
Normal file
117
src/App/Mode.php
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Friendica\App;
|
||||||
|
|
||||||
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mode of the current Friendica Node
|
||||||
|
*
|
||||||
|
* @package Friendica\App
|
||||||
|
*/
|
||||||
|
class Mode
|
||||||
|
{
|
||||||
|
const LOCALCONFIGPRESENT = 1;
|
||||||
|
const DBAVAILABLE = 2;
|
||||||
|
const DBCONFIGAVAILABLE = 4;
|
||||||
|
const MAINTENANCEDISABLED = 8;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @var int the mode of this Application
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private $mode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string the basepath of the application
|
||||||
|
*/
|
||||||
|
private $basepath;
|
||||||
|
|
||||||
|
public function __construct($basepath = '')
|
||||||
|
{
|
||||||
|
$this->basepath = $basepath;
|
||||||
|
$this->mode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the App mode
|
||||||
|
*
|
||||||
|
* - App::MODE_INSTALL : Either the database connection can't be established or the config table doesn't exist
|
||||||
|
* - App::MODE_MAINTENANCE: The maintenance mode has been set
|
||||||
|
* - App::MODE_NORMAL : Normal run with all features enabled
|
||||||
|
*
|
||||||
|
* @param string $basepath the Basepath of the Application
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function determine($basepath = null)
|
||||||
|
{
|
||||||
|
if (!empty($basepath)) {
|
||||||
|
$this->basepath = $basepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode = 0;
|
||||||
|
|
||||||
|
if (!file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')
|
||||||
|
&& !file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= Mode::LOCALCONFIGPRESENT;
|
||||||
|
|
||||||
|
if (!DBA::connected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= Mode::DBAVAILABLE;
|
||||||
|
|
||||||
|
if (DBA::fetchFirst("SHOW TABLES LIKE 'config'") === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= Mode::DBCONFIGAVAILABLE;
|
||||||
|
|
||||||
|
if (Config::get('system', 'maintenance')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= Mode::MAINTENANCEDISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks, if the Friendica Node has the given mode
|
||||||
|
*
|
||||||
|
* @param int $mode A mode to test
|
||||||
|
*
|
||||||
|
* @return bool returns true, if the mode is set
|
||||||
|
*/
|
||||||
|
public function has($mode)
|
||||||
|
{
|
||||||
|
return ($this->mode & $mode) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install mode is when the local config file is missing or the DB schema hasn't been installed yet.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isInstall()
|
||||||
|
{
|
||||||
|
return !$this->has(Mode::LOCALCONFIGPRESENT) ||
|
||||||
|
!$this->has(MODE::DBCONFIGAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normal mode is when the local config file is set, the DB schema is installed and the maintenance mode is off.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isNormal()
|
||||||
|
{
|
||||||
|
return $this->has(Mode::LOCALCONFIGPRESENT) &&
|
||||||
|
$this->has(Mode::DBAVAILABLE) &&
|
||||||
|
$this->has(Mode::DBCONFIGAVAILABLE) &&
|
||||||
|
$this->has(Mode::MAINTENANCEDISABLED);
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,7 +9,7 @@ namespace Friendica;
|
||||||
* The filename of the module in src/Module needs to match the class name
|
* The filename of the module in src/Module needs to match the class name
|
||||||
* exactly to make the module available.
|
* exactly to make the module available.
|
||||||
*
|
*
|
||||||
* @author Hypolite Petovan mrpetovan@gmail.com
|
* @author Hypolite Petovan <hypolite@mrpetovan.com>
|
||||||
*/
|
*/
|
||||||
abstract class BaseModule extends BaseObject
|
abstract class BaseModule extends BaseObject
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,16 @@ abstract class BaseModule extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Module GET method to display raw content from technical endpoints
|
||||||
|
*
|
||||||
|
* Extend this method if the module is supposed to return communication data,
|
||||||
|
* e.g. from protocol implementations.
|
||||||
|
*/
|
||||||
|
public static function rawContent()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,9 @@ namespace Friendica\Content;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Util\Network;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ContactSelector class
|
* @brief ContactSelector class
|
||||||
|
@ -68,28 +70,29 @@ class ContactSelector
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $s network
|
* @param string $network network
|
||||||
* @param string $profile optional, default empty
|
* @param string $profile optional, default empty
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function networkToName($s, $profile = "")
|
public static function networkToName($network, $profile = "")
|
||||||
{
|
{
|
||||||
$nets = [
|
$nets = [
|
||||||
Protocol::DFRN => L10n::t('Friendica'),
|
Protocol::DFRN => L10n::t('Friendica'),
|
||||||
Protocol::OSTATUS => L10n::t('OStatus'),
|
Protocol::OSTATUS => L10n::t('OStatus'),
|
||||||
Protocol::FEED => L10n::t('RSS/Atom'),
|
Protocol::FEED => L10n::t('RSS/Atom'),
|
||||||
Protocol::MAIL => L10n::t('Email'),
|
Protocol::MAIL => L10n::t('Email'),
|
||||||
Protocol::DIASPORA => L10n::t('Diaspora'),
|
Protocol::DIASPORA => L10n::t('Diaspora'),
|
||||||
Protocol::ZOT => L10n::t('Zot!'),
|
Protocol::ZOT => L10n::t('Zot!'),
|
||||||
Protocol::LINKEDIN => L10n::t('LinkedIn'),
|
Protocol::LINKEDIN => L10n::t('LinkedIn'),
|
||||||
Protocol::XMPP => L10n::t('XMPP/IM'),
|
Protocol::XMPP => L10n::t('XMPP/IM'),
|
||||||
Protocol::MYSPACE => L10n::t('MySpace'),
|
Protocol::MYSPACE => L10n::t('MySpace'),
|
||||||
Protocol::GPLUS => L10n::t('Google+'),
|
Protocol::GPLUS => L10n::t('Google+'),
|
||||||
Protocol::PUMPIO => L10n::t('pump.io'),
|
Protocol::PUMPIO => L10n::t('pump.io'),
|
||||||
Protocol::TWITTER => L10n::t('Twitter'),
|
Protocol::TWITTER => L10n::t('Twitter'),
|
||||||
Protocol::DIASPORA2 => L10n::t('Diaspora Connector'),
|
Protocol::DIASPORA2 => L10n::t('Diaspora Connector'),
|
||||||
Protocol::STATUSNET => L10n::t('GNU Social Connector'),
|
Protocol::STATUSNET => L10n::t('GNU Social Connector'),
|
||||||
Protocol::PNUT => L10n::t('pnut'),
|
Protocol::ACTIVITYPUB => L10n::t('ActivityPub'),
|
||||||
|
Protocol::PNUT => L10n::t('pnut'),
|
||||||
];
|
];
|
||||||
|
|
||||||
Addon::callHooks('network_to_name', $nets);
|
Addon::callHooks('network_to_name', $nets);
|
||||||
|
@ -97,15 +100,37 @@ class ContactSelector
|
||||||
$search = array_keys($nets);
|
$search = array_keys($nets);
|
||||||
$replace = array_values($nets);
|
$replace = array_values($nets);
|
||||||
|
|
||||||
$networkname = str_replace($search, $replace, $s);
|
$networkname = str_replace($search, $replace, $network);
|
||||||
|
|
||||||
if ((in_array($s, [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) && ($profile != "")) {
|
if ((in_array($network, [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) && ($profile != "")) {
|
||||||
$r = DBA::fetchFirst("SELECT `gserver`.`platform` FROM `gcontact`
|
// Create the server url out of the profile url
|
||||||
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
|
$parts = parse_url($profile);
|
||||||
WHERE `gcontact`.`nurl` = ? AND `platform` != ''", normalise_link($profile));
|
unset($parts['path']);
|
||||||
|
$server_url = [normalise_link(Network::unparseURL($parts))];
|
||||||
|
|
||||||
if (DBA::isResult($r)) {
|
// Fetch the server url
|
||||||
$networkname = $r['platform'];
|
$gcontact = DBA::selectFirst('gcontact', ['server_url'], ['nurl' => normalise_link($profile)]);
|
||||||
|
if (!empty($gcontact) && !empty($gcontact['server_url'])) {
|
||||||
|
$server_url[] = normalise_link($gcontact['server_url']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now query the GServer for the platform name
|
||||||
|
$gserver = DBA::selectFirst('gserver', ['platform', 'network'], ['nurl' => $server_url]);
|
||||||
|
|
||||||
|
if (DBA::isResult($gserver)) {
|
||||||
|
if (!empty($gserver['platform'])) {
|
||||||
|
$platform = $gserver['platform'];
|
||||||
|
} elseif (!empty($gserver['network']) && ($gserver['network'] != Protocol::ACTIVITYPUB)) {
|
||||||
|
$platform = self::networkToName($gserver['network']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($platform)) {
|
||||||
|
$networkname = $platform;
|
||||||
|
|
||||||
|
if ($network == Protocol::ACTIVITYPUB) {
|
||||||
|
$networkname .= ' (AP)';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue