e107inc/e107

View on GitHub
usersettings.php

Summary

Maintainability
A
2 hrs
Test Coverage
F
20%

Consider simplifying this complex logical expression.
Open

                if(!is_array($info) || ($info['user_admin'] == 1 && (!defined('ADMINPERMS') || ADMINPERMS !== '0')) || ((!defined('ADMINPERMS') || ADMINPERMS !== '0') && !getperms('4')))
                {
                    e107::redirect();
                    exit();
                }
Severity: Major
Found in usersettings.php - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                            if ($nid != $udata['user_baseclasslist'])
                            {
                                if (US_DEBUG)
                                {
                                    e107::getLog()->addEvent(10, debug_backtrace(), "DEBUG", "Usersettings test", "Write back classes; old list: {$udata['user_class']}; new list: ".$nid, false, LOG_TO_ROLLING);
    Severity: Major
    Found in usersettings.php - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

                              if ($upload['name'] && ($upload['index'] == 'avatar') && $pref['avatar_upload'])
                              {
                                  // avatar uploaded - give it a reference which identifies it as server-stored
                                  // Vetting routines will do resizing and so on
                                  $_POST['image'] = '-upload-'.$upload['name'];
      Severity: Major
      Found in usersettings.php - About 40 mins to fix

        Avoid too many return statements within this method.
        Open

                return false;
        Severity: Major
        Found in usersettings.php - About 30 mins to fix

          Argument 1 (var) is ?array|?array{user_class:string}|?array{user_email:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_loginname:mixed}|?array{user_email:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_email?:null,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_image:mixed,user_name:mixed,user_sess:''}|?array{user_loginname:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_email:mixed}|?array{user_loginname:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_loginname?:null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_email:mixed}|?array{user_name:mixed}|?array{user_password:,user_email:mixed|null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null}|?array{user_password:}|?array{user_password?:null,user_email:mixed|null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null}|?array{user_prefs:array|string}|?array{user_sess:''}|?array{}|?bool|?string but \count() takes \Countable|array
          Open

                      if (count($changedUserData))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (var) is ?array|?array{user_class:string,user_image:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null,user_name:null,user_password?:null}|?array{user_email?:null,user_class:string,user_image:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null,user_name:null,user_password?:null}|?bool|?string but \count() takes \Countable|array
          Open

                          if (count($changedUserData) && isset($user_logging_opts[USER_AUDIT_NEW_SET]))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (var) is ?array<string>|?array<string>|?array<string>|?array<string>|?array{user_email:mixed,user_password:,user_name:mixed}|?array{user_name:mixed}|?array{user_password:,user_name:mixed}|?array{}</string></string></string></string> but \count() takes \Countable|array
          Open

                                  if (count($do_log) > 1) { $log_action = USER_AUDIT_NEW_SET; } // Log multiple entries to one record
          Severity: Minor
          Found in usersettings.php by phan

          Call to undeclared method \e_shortcode::reset
          Open

                  e107::getScBatch('usersettings')->setVars($curVal)->reset();
          Severity: Critical
          Found in usersettings.php by phan

          Call to undeclared method \e_db::escape
          Open

                          $changedUserData['user_password'] = $sql->escape($userMethods->HashPassword($savePassword, $loginname), false);
          Severity: Critical
          Found in usersettings.php by phan

          Suspicious array access to nullable ?array|?array<string>|?array<string>|?array<string>|?array<string>|?bool|?string</string></string></string></string>
          Open

                  $curVal['user_class'] = varset($changedUserData['user_class'], $curVal['user_class']);
          Severity: Minor
          Found in usersettings.php by phan

          Call to deprecated function \getperms() defined at /code/class2.php:1322
          Open

                          if(!is_array($info) || ($info['user_admin'] == 1 && (!defined('ADMINPERMS') || ADMINPERMS !== '0')) || ((!defined('ADMINPERMS') || ADMINPERMS !== '0') && !getperms('4')))
          Severity: Minor
          Found in usersettings.php by phan

          Variable $alldata was undeclared, but array fields are being added to it.
          Open

                              $alldata['errors']['user_loginname'] = ERR_GENERIC;
          Severity: Info
          Found in usersettings.php by phan

          Variable $changedData was undeclared, but array fields are being added to it.
          Open

                          $changedData['data'] = $changedUserData;
          Severity: Info
          Found in usersettings.php by phan

          Argument 2 (value) is 1 but \e_form::button() takes array|string defined at /code/e107_handlers/form_handler.php:3862
          Open

                          ".e107::getForm()->button('SaveValidatedInfo',1, 'submit', LAN_ENTER)."
          Severity: Minor
          Found in usersettings.php by phan

          When fetching an array index from a value of type array<int>|array<int>|int|string,</int></int> found an array index of type 'avatar', but expected the index to be of type int
          Open

                      if (varset($_FILES['file_userfile']['error']['avatar'], false) === UPLOAD_ERR_OK || varset($_FILES['file_userfile']['error']['photo'], false) == UPLOAD_ERR_OK)
          Severity: Minor
          Found in usersettings.php by phan

          Call to deprecated function \getperms() defined at /code/class2.php:1322
          Open

                          if (ADMIN && getperms('4'))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 2 (args) is ?array|?array{user_class:string,user_image:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null,user_name:null,user_password?:null}|?array{user_email?:null,user_class:string,user_image:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null,user_name:null,user_password?:null}|?bool|?string but \array_merge() takes array
          Open

                              $do_log = array_merge($do_log, $changedUserData);
          Severity: Minor
          Found in usersettings.php by phan

          Returning type null but init() is declared to return bool
          Open

                      return null;
          Severity: Minor
          Found in usersettings.php by phan

          Call to deprecated function \getperms() defined at /code/class2.php:1322
          Open

                              if (!(ADMIN && getperms('4')))
          Severity: Minor
          Found in usersettings.php by phan

          Call to deprecated function \getperms() defined at /code/class2.php:1322
          Open

          if ((!ADMIN || !getperms("4")) && e_QUERY && e_QUERY != "update" && substr(e_QUERY, 0, 4) !== 'del=')
          Severity: Minor
          Found in usersettings.php by phan

          When fetching an array index from a value of type array<int>|array<int>|int|string,</int></int> found an array index of type 'photo', but expected the index to be of type int
          Open

                      if (varset($_FILES['file_userfile']['error']['avatar'], false) === UPLOAD_ERR_OK || varset($_FILES['file_userfile']['error']['photo'], false) == UPLOAD_ERR_OK)
          Severity: Minor
          Found in usersettings.php by phan

          Argument 3 (uid) is bool but \check_class() takes int defined at /code/class2.php:1207
          Open

                              if (!check_class($pref['displayname_class'], $udata['user_classlist'], $adminEdit))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (posted) is false|string but \UserHandler::hasReadonlyField() takes array defined at /code/e107_handlers/user_handler.php:192
          Open

                          if ($this->getValidationKey($new_data) !== $_POST['updated_key'] || ($userMethods->hasReadonlyField($new_data) !==false))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (var) is ?array<string>|?array<string>|?array<string>|?array<string>|?array{user_email:mixed,user_password:,user_name:mixed}|?array{user_name:mixed}|?array{user_password:,user_name:mixed}|?array{}</string></string></string></string> but \count() takes \Countable|array
          Open

                          if (count($do_log))
          Severity: Minor
          Found in usersettings.php by phan

          Suspicious array access to nullable ?array|?array{user_class:string}|?array{user_image:mixed,user_name:mixed,user_sess:''}|?array{user_name:mixed}|?array{user_sess:''}|?array{}|?bool|?string
          Open

                          $loginname = $changedUserData['user_loginname'] ? $changedUserData['user_loginname'] : $udata['user_loginname'];
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (var) is ?array|?array{_CHANGED_BY_UID:1}|?array{_CHANGED_BY_UNAME:'e107-cli'}|?array{ue:array|array{user_extended_id:int}|null}|?array{user_class:string}|?array{user_email:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_loginname:mixed}|?array{user_email:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_email?:null,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_id:array|mixed|string}|?array{user_image:mixed,user_name:mixed,user_sess:''}|?array{user_loginname:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_email:mixed}|?array{user_loginname:mixed,user_class:string,user_image:mixed,user_name:mixed,user_sess:''}|?array{user_loginname?:null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_email:mixed}|?array{user_name:array|mixed|string}|?array{user_name:mixed}|?array{user_name?:null,user_loginname:mixed|null,user_class:string,user_image:mixed,user_sess:'',user_email:mixed|null,user_prefs:array|string,user_password?:null,user_id:array|mixed|string,_CHANGED_BY_UID:1,_CHANGED_BY_UNAME:'e107-cli'}|?array{user_password:,user_email:mixed|null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null}|?array{user_password:}|?array{user_password?:null,user_email:mixed|null,user_class:string,user_image:mixed,user_name:mixed,user_sess:'',user_prefs:array|string,user_loginname:mixed|null}|?array{user_prefs:array|string}|?array{user_sess:''}|?array{}|?bool|?string but \count() takes \Countable|array
          Open

                      if (count($triggerData))
          Severity: Minor
          Found in usersettings.php by phan

          Argument 1 (ArrayData) is ?array|?array<string>|?array<string>|?array<string>|?array<string>|?bool|?string</string></string></string></string> but \e107::serialize() takes array defined at /code/e107_handlers/e107_class.php:2131
          Open

                  $updated_data       = e107::serialize($changedUserData,'json');
          Severity: Minor
          Found in usersettings.php by phan

          There are no issues that match your filters.

          Category
          Status