X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=60c8bf5a30ebbfdb750d949b40d8bfb6ea066b8a;hb=b36d4eb0dd4bdc25a468c95c749bfae1b6324be9;hp=b90c1fb2e21f7e244ed24f3eae6ffbdc39652026;hpb=018858934b0423efb7dd07e660f621f1e8eb75cd;p=friendica.git diff --git a/boot.php b/boot.php index b90c1fb2e2..60c8bf5a30 100644 --- a/boot.php +++ b/boot.php @@ -27,153 +27,37 @@ * easily as email does today. */ -use Friendica\Model\Contact; - -define('FRIENDICA_PLATFORM', 'Friendica'); -define('FRIENDICA_CODENAME', 'Giant Rhubarb'); -define('FRIENDICA_VERSION', '2022.12-dev'); -define('DFRN_PROTOCOL_VERSION', '2.23'); -define('NEW_TABLE_STRUCTURE_VERSION', 1288); - -/** - * Constant with a HTML line break. - * - * 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. - */ -define('EOL', "
\r\n"); - -/** - * @name CP - * - * Type of the community page - * @{ - */ -define('CP_NO_INTERNAL_COMMUNITY', -2); -define('CP_NO_COMMUNITY_PAGE', -1); -define('CP_USERS_ON_SERVER', 0); -define('CP_GLOBAL_COMMUNITY', 1); -define('CP_USERS_AND_GLOBAL', 2); -/** - * @} - */ - -/** - * @name Gravity - * - * Item weight for query ordering - * @{ - */ -define('GRAVITY_PARENT', 0); -define('GRAVITY_ACTIVITY', 3); -define('GRAVITY_COMMENT', 6); -define('GRAVITY_UNKNOWN', 9); -/* @}*/ - -// Normally this constant is defined - but not if "pcntl" isn't installed -if (!defined('SIGTERM')) { - define('SIGTERM', 15); -} - -/** - * Depending on the PHP version this constant does exist - or not. - * See here: http://php.net/manual/en/curl.constants.php#117928 - */ -if (!defined('CURLE_OPERATION_TIMEDOUT')) { - define('CURLE_OPERATION_TIMEDOUT', CURLE_OPERATION_TIMEOUTED); -} - -if (!function_exists('exif_imagetype')) { - function exif_imagetype($file) - { - $size = getimagesize($file); - return $size[2]; - } -} +use Friendica\Core\Session; /** * Returns the user id of locally logged in user or false. * * @return int|bool user id or false + * @deprecated since version 2022.12, use Core\Session::getLocalUser() instead */ function local_user() { - if (!empty($_SESSION['authenticated']) && !empty($_SESSION['uid'])) { - return intval($_SESSION['uid']); - } - - return false; + return Session::getLocalUser(); } /** * Returns the public contact id of logged in user or false. * * @return int|bool public contact id or false + * @deprecated since version 2022.12, use Core\Session:: getPublicContact() instead */ function public_contact() { - static $public_contact_id = false; - - if (!$public_contact_id && !empty($_SESSION['authenticated'])) { - if (!empty($_SESSION['my_address'])) { - // Local user - $public_contact_id = intval(Contact::getIdForURL($_SESSION['my_address'], 0, false)); - } elseif (!empty($_SESSION['visitor_home'])) { - // Remote user - $public_contact_id = intval(Contact::getIdForURL($_SESSION['visitor_home'], 0, false)); - } - } elseif (empty($_SESSION['authenticated'])) { - $public_contact_id = false; - } - - return $public_contact_id; + return Session::getPublicContact(); } /** * Returns public contact id of authenticated site visitor or false * * @return int|bool visitor_id or false + * @deprecated since version 2022.12, use Core\Session:: getRemoteUser() instead */ function remote_user() { - if (empty($_SESSION['authenticated'])) { - return false; - } - - if (!empty($_SESSION['visitor_id'])) { - return intval($_SESSION['visitor_id']); - } - - return false; -} - -/** - * Show an error message to user. - * - * This function save text in session, to be shown to the user at next page load - * - * @param string $s - Text of notice - * - * @return void - * @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead - */ -function notice(string $s) -{ - \Friendica\DI::sysmsg()->addNotice($s); -} - -/** - * Show an info message to user. - * - * This function save text in session, to be shown to the user at next page load - * - * @param string $s - Text of notice - * - * @return void - * @deprecated since version 2022.09, use \Friendica\Navigation\SystemMessages instead - */ -function info(string $s) -{ - \Friendica\DI::sysmsg()->addInfo($s); + return Session::getRemoteUser(); }