X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=boot.php;h=3571a77c165de564f633520b3b32f19386146dd1;hb=f8c0f24e34e124ab782d5dcf3d2d658d70e19e5c;hp=1f503c908a6935c087bd1ef8de8c7ced72342473;hpb=ff2164ee85036ba9397d4006f620f31590227043;p=friendica.git diff --git a/boot.php b/boot.php index 1f503c908a..3571a77c16 100644 --- a/boot.php +++ b/boot.php @@ -23,14 +23,16 @@ use Friendica\Core\Config; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\System; +use Friendica\Core\Session; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\Term; use Friendica\Util\BasePath; use Friendica\Util\DateTimeFormat; define('FRIENDICA_PLATFORM', 'Friendica'); -define('FRIENDICA_CODENAME', 'The Tazmans Flax-lily'); -define('FRIENDICA_VERSION', '2019.03-dev'); +define('FRIENDICA_CODENAME', 'Dalmatian Bellflower'); +define('FRIENDICA_VERSION', '2019.12-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); define('NEW_UPDATE_ROUTINE_VERSION', 1170); @@ -81,17 +83,6 @@ define('MAX_IMAGE_LENGTH', -1); */ define('DEFAULT_DB_ENGINE', 'InnoDB'); -/** - * @name SSL Policy - * - * SSL redirection policies - * @{ - */ -define('SSL_POLICY_NONE', 0); -define('SSL_POLICY_FULL', 1); -define('SSL_POLICY_SELFSIGN', 2); -/* @}*/ - /** @deprecated since version 2019.03, please use \Friendica\Module\Register::CLOSED instead */ define('REGISTER_CLOSED', \Friendica\Module\Register::CLOSED); /** @deprecated since version 2019.03, please use \Friendica\Module\Register::APPROVE instead */ @@ -171,23 +162,27 @@ define('NOTIFY_SYSTEM', 32768); /* @}*/ -/** - * @name Term - * - * Tag/term types - * @{ - */ -define('TERM_UNKNOWN', 0); -define('TERM_HASHTAG', 1); -define('TERM_MENTION', 2); -define('TERM_CATEGORY', 3); -define('TERM_PCATEGORY', 4); -define('TERM_FILE', 5); -define('TERM_SAVEDSEARCH', 6); -define('TERM_CONVERSATION', 7); - -define('TERM_OBJ_POST', 1); -define('TERM_OBJ_PHOTO', 2); +/** @deprecated since 2019.03, use Term::UNKNOWN instead */ +define('TERM_UNKNOWN', Term::UNKNOWN); +/** @deprecated since 2019.03, use Term::HASHTAG instead */ +define('TERM_HASHTAG', Term::HASHTAG); +/** @deprecated since 2019.03, use Term::MENTION instead */ +define('TERM_MENTION', Term::MENTION); +/** @deprecated since 2019.03, use Term::CATEGORY instead */ +define('TERM_CATEGORY', Term::CATEGORY); +/** @deprecated since 2019.03, use Term::PCATEGORY instead */ +define('TERM_PCATEGORY', Term::PCATEGORY); +/** @deprecated since 2019.03, use Term::FILE instead */ +define('TERM_FILE', Term::FILE); +/** @deprecated since 2019.03, use Term::SAVEDSEARCH instead */ +define('TERM_SAVEDSEARCH', Term::SAVEDSEARCH); +/** @deprecated since 2019.03, use Term::CONVERSATION instead */ +define('TERM_CONVERSATION', Term::CONVERSATION); + +/** @deprecated since 2019.03, use Term::OBJECT_TYPE_POST instead */ +define('TERM_OBJ_POST', Term::OBJECT_TYPE_POST); +/** @deprecated since 2019.03, use Term::OBJECT_TYPE_PHOTO instead */ +define('TERM_OBJ_PHOTO', Term::OBJECT_TYPE_PHOTO); /** * @name Namespaces @@ -199,6 +194,7 @@ define('NAMESPACE_ZOT', 'http://purl.org/zot'); define('NAMESPACE_DFRN', 'http://purl.org/macgirvin/dfrn/1.0'); define('NAMESPACE_THREAD', 'http://purl.org/syndication/thread/1.0'); define('NAMESPACE_TOMB', 'http://purl.org/atompub/tombstones/1.0'); +define('NAMESPACE_ACTIVITY2', 'https://www.w3.org/ns/activitystreams#'); define('NAMESPACE_ACTIVITY', 'http://activitystrea.ms/spec/1.0/'); define('NAMESPACE_ACTIVITY_SCHEMA', 'http://activitystrea.ms/schema/1.0/'); define('NAMESPACE_MEDIA', 'http://purl.org/syndication/atommedia'); @@ -241,6 +237,7 @@ define('ACTIVITY_FAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'favorite'); define('ACTIVITY_UNFAVORITE', NAMESPACE_ACTIVITY_SCHEMA . 'unfavorite'); define('ACTIVITY_SHARE', NAMESPACE_ACTIVITY_SCHEMA . 'share'); define('ACTIVITY_DELETE', NAMESPACE_ACTIVITY_SCHEMA . 'delete'); +define('ACTIVITY2_ANNOUNCE', NAMESPACE_ACTIVITY2 . 'Announce'); define('ACTIVITY_POKE', NAMESPACE_ZOT . '/activity/poke'); @@ -325,46 +322,6 @@ function get_app() return BaseObject::getApp(); } -/** - * Return the provided variable value if it exists and is truthy or the provided - * default value instead. - * - * Works with initialized variables and potentially uninitialized array keys - * - * Usages: - * - defaults($var, $default) - * - defaults($array, 'key', $default) - * - * @param array $args - * @brief Returns a defaut value if the provided variable or array key is falsy - * @return mixed - */ -function defaults(...$args) -{ - if (count($args) < 2) { - throw new BadFunctionCallException('defaults() requires at least 2 parameters'); - } - if (count($args) > 3) { - throw new BadFunctionCallException('defaults() cannot use more than 3 parameters'); - } - if (count($args) === 3 && is_null($args[1])) { - throw new BadFunctionCallException('defaults($arr, $key, $def) $key is null'); - } - - // The default value always is the last argument - $return = array_pop($args); - - if (count($args) == 2 && is_array($args[0]) && !empty($args[0][$args[1]])) { - $return = $args[0][$args[1]]; - } - - if (count($args) == 1 && !empty($args[0])) { - $return = $args[0]; - } - - return $return; -} - /** * @brief Used to end the current process, after saving session state. * @deprecated @@ -418,20 +375,14 @@ function public_contact() */ function remote_user() { - // You cannot be both local and remote. - // Unncommented by rabuzarus because remote authentication to local - // profiles wasn't possible anymore (2018-04-12). -// if (local_user()) { -// return false; -// } - - if (empty($_SESSION)) { + if (empty($_SESSION['authenticated'])) { return false; } - if (!empty($_SESSION['authenticated']) && !empty($_SESSION['visitor_id'])) { + if (!empty($_SESSION['visitor_id'])) { return intval($_SESSION['visitor_id']); } + return false; } @@ -535,40 +486,7 @@ function is_site_admin() $adminlist = explode(',', str_replace(' ', '', $admin_email)); - return local_user() && $admin_email && in_array(defaults($a->user, 'email', ''), $adminlist); -} - -/** - * @brief Returns querystring as string from a mapped array. - * - * @param array $params mapped array with query parameters - * @param string $name of parameter, default null - * - * @return string - */ -function build_querystring($params, $name = null) -{ - $ret = ""; - foreach ($params as $key => $val) { - if (is_array($val)) { - /// @TODO maybe not compare against null, use is_null() - if ($name == null) { - $ret .= build_querystring($val, $key); - } else { - $ret .= build_querystring($val, $name . "[$key]"); - } - } else { - $val = urlencode($val); - /// @TODO maybe not compare against null, use is_null() - if ($name != null) { - /// @TODO two string concated, can be merged to one - $ret .= $name . "[$key]" . "=$val&"; - } else { - $ret .= "$key=$val&"; - } - } - } - return $ret; + return local_user() && $admin_email && in_array($a->user['email'] ?? '', $adminlist); } function explode_querystring($query)