]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #7752 from kPherox/develop
[friendica.git] / boot.php
index 224eba1f45b4f6267d71a6c43b013363440e5178..3571a77c165de564f633520b3b32f19386146dd1 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -23,6 +23,7 @@ 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;
@@ -31,7 +32,7 @@ use Friendica\Util\DateTimeFormat;
 
 define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Dalmatian Bellflower');
-define('FRIENDICA_VERSION',      '2019.09-rc');
+define('FRIENDICA_VERSION',      '2019.12-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
@@ -321,47 +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
- * @deprecated since version 2019.06, use native coalesce operator (??) instead
- */
-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
@@ -413,28 +373,13 @@ function public_contact()
  *
  * @return int|bool visitor_id or false
  */
-function remote_user($uid = null)
+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['authenticated'])) {
                return false;
        }
 
-       if (!is_null($uid) && !empty($_SESSION['remote'])) {
-               /// @todo replace it with this:
-               // if (!empty($_SESSION['remote'][$uid])) ...
-               foreach ($_SESSION['remote'] as $visitor) {
-                       if ($visitor['uid'] == $uid) {
-                               return $visitor['cid'];
-                       }
-               }
-       } elseif (is_null($uid) && !empty($_SESSION['visitor_id'])) {
+       if (!empty($_SESSION['visitor_id'])) {
                return intval($_SESSION['visitor_id']);
        }
 
@@ -541,7 +486,7 @@ function is_site_admin()
 
        $adminlist = explode(',', str_replace(' ', '', $admin_email));
 
-       return local_user() && $admin_email && in_array(defaults($a->user, 'email', ''), $adminlist);
+       return local_user() && $admin_email && in_array($a->user['email'] ?? '', $adminlist);
 }
 
 function explode_querystring($query)