2010-07-01 19:48:07 -04:00
|
|
|
<?php
|
2018-02-04 18:44:42 -05:00
|
|
|
/**
|
2022-01-02 02:27:47 -05:00
|
|
|
* @copyright Copyright (C) 2010-2022, the Friendica project
|
2020-02-09 10:18:46 -05:00
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2016-04-03 07:48:31 -04:00
|
|
|
*
|
2015-12-23 19:31:17 -05:00
|
|
|
* Friendica is a communications platform for integrated social communications
|
|
|
|
* utilising decentralised communications and linkage to several indie social
|
|
|
|
* projects - as well as popular mainstream providers.
|
2016-04-03 07:48:31 -04:00
|
|
|
*
|
2015-12-23 19:31:17 -05:00
|
|
|
* Our mission is to free our friends and families from the clutches of
|
|
|
|
* data-harvesting corporations, and pave the way to a future where social
|
|
|
|
* communications are free and open and flow between alternate providers as
|
|
|
|
* easily as email does today.
|
|
|
|
*/
|
2010-07-01 19:48:07 -04:00
|
|
|
|
2022-10-17 17:11:00 -04:00
|
|
|
use Friendica\Core\Session;
|
2017-01-17 14:21:46 -05:00
|
|
|
|
2015-12-25 12:36:13 -05:00
|
|
|
/**
|
2020-01-19 01:05:23 -05:00
|
|
|
* Constant with a HTML line break.
|
2015-12-25 12:36:13 -05:00
|
|
|
*
|
|
|
|
* Contains a HTML line break (br) element and a real carriage return with line
|
|
|
|
* feed for the source.
|
|
|
|
* This can be used in HTML and JavaScript where needed a line break.
|
|
|
|
*/
|
2017-11-09 11:05:18 -05:00
|
|
|
define('EOL', "<br />\r\n");
|
2011-08-16 23:05:02 -04:00
|
|
|
|
2010-12-10 07:04:35 -05:00
|
|
|
/**
|
2015-12-25 14:58:26 -05:00
|
|
|
* @name Gravity
|
2016-10-01 23:29:30 -04:00
|
|
|
*
|
2015-12-25 14:58:26 -05:00
|
|
|
* Item weight for query ordering
|
|
|
|
* @{
|
2010-12-10 07:04:35 -05:00
|
|
|
*/
|
2017-11-09 11:05:18 -05:00
|
|
|
define('GRAVITY_PARENT', 0);
|
2018-06-27 14:09:33 -04:00
|
|
|
define('GRAVITY_ACTIVITY', 3);
|
2017-11-09 11:05:18 -05:00
|
|
|
define('GRAVITY_COMMENT', 6);
|
2018-06-27 14:09:33 -04:00
|
|
|
define('GRAVITY_UNKNOWN', 9);
|
2015-12-25 14:58:26 -05:00
|
|
|
/* @}*/
|
|
|
|
|
2016-05-22 06:31:32 -04:00
|
|
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
2022-06-23 04:14:18 -04:00
|
|
|
if (!defined('SIGTERM')) {
|
|
|
|
define('SIGTERM', 15);
|
2017-03-19 04:04:04 -04:00
|
|
|
}
|
2017-05-02 22:42:29 -04:00
|
|
|
|
2015-12-23 19:31:17 -05:00
|
|
|
/**
|
2020-01-19 01:05:23 -05:00
|
|
|
* Returns the user id of locally logged in user or false.
|
2016-10-01 23:29:30 -04:00
|
|
|
*
|
2015-12-23 19:31:17 -05:00
|
|
|
* @return int|bool user id or false
|
|
|
|
*/
|
2017-11-09 11:05:18 -05:00
|
|
|
function local_user()
|
|
|
|
{
|
2022-10-17 17:11:00 -04:00
|
|
|
return Session::getLocalUser();
|
2012-04-09 08:04:49 -04:00
|
|
|
}
|
2010-07-01 19:48:07 -04:00
|
|
|
|
2017-03-06 05:06:05 -05:00
|
|
|
/**
|
2020-01-19 01:05:23 -05:00
|
|
|
* Returns the public contact id of logged in user or false.
|
2017-03-06 05:06:05 -05:00
|
|
|
*
|
|
|
|
* @return int|bool public contact id or false
|
|
|
|
*/
|
2017-11-09 11:05:18 -05:00
|
|
|
function public_contact()
|
|
|
|
{
|
2022-10-17 17:11:00 -04:00
|
|
|
return Session::getPublicContact();
|
2017-03-06 05:06:05 -05:00
|
|
|
}
|
|
|
|
|
2015-12-23 19:31:17 -05:00
|
|
|
/**
|
2020-08-04 22:44:42 -04:00
|
|
|
* Returns public contact id of authenticated site visitor or false
|
2016-10-01 23:29:30 -04:00
|
|
|
*
|
2015-12-23 19:31:17 -05:00
|
|
|
* @return int|bool visitor_id or false
|
|
|
|
*/
|
2019-09-28 05:59:08 -04:00
|
|
|
function remote_user()
|
2017-11-09 11:05:18 -05:00
|
|
|
{
|
2022-10-17 17:11:00 -04:00
|
|
|
return Session::getRemoteUser();
|
2012-04-09 08:04:49 -04:00
|
|
|
}
|