We need to overwrite the global "alternate login url" setting if wayf is enabled.

@param string $data Form data.
@return string Empty when no errors.
355980
public function write_setting($data) {
        global $CFG;

        $login = get_config('auth_shibboleth', 'alt_login');
        if (isset($data) && !empty($data) && isset($login) && $login == 'on') {

            // Need to use the get_idp_list() function here.
            require_once($CFG->dirroot.'/auth/shibboleth/auth.php');

            $idplist = get_idp_list($data);
            if (count($idplist) < 1) {
                return false;
            }
            $data = '';
            foreach ($idplist as $idp => $value) {
                $data .= $idp.', '.$value[0];
                if (isset($value[1])) {
                    // Value[1] is optional.
                    $data .= ', '.$value[1] . "\n";
                } else {
                    $data .= "\n";
                }
            }
        }
        return parent::write_setting($data);
    }
554881
protected function getDefaultPayload( $data )
	{
		$payload = ['payload' => base64_encode( $data ), 'last_activity' => time()];

		if ( Acct::check() )
			$payload['user_id'] = Acct::acct()->getId();

		if ( $request = Factory::i()->request() )
		{
			$payload['ip_address'] = $request->ip();
			$payload['user_agent'] = substr( (string) $request->header( 'User-Agent' ), 0, 500 );
		}

		return $payload;
	}
695246
public function afterSaveRoute($data)
    {
        $this->accesslog->logChange($this->request, null, $data);

        //Get default routing
        $url = $this->getAfterSaveRoute($data);

        //If we have a route, reroute
        if ($url !== null && $url !== false) {
            $this->_helper->redirector->gotoRoute($url, null, true);
            return true;
        }

        // Do not reroute
        return false;
    }
1219475
public function getSafeRedirectUrl($default, $data = null, $key = 'redirect') {
		$redirectUrl = $data ?: ($this->Controller->getRequest()->getData($key) ?: $this->Controller->getRequest()->getQuery($key));
		if ($redirectUrl && (mb_substr($redirectUrl, 0, 1) !== '/' || mb_substr($redirectUrl, 0, 2) === '//')) {
			$redirectUrl = null;
		}

		return $redirectUrl ?: $default;
	}
850243
public function redislize($data)
    {
        // Only serialize if it's not a string or a integer
        if (!is_string($data) && !is_int($data)) {
            return urlencode(serialize($data));
        }
        // Encode string to escape wrong saves
        return urlencode($data);
    }
356049
public function reverseTransform($data)
    {
        if (self::MODE_TO_INTERNAL === (self::MODE_TO_INTERNAL & $this->mode)) {
            return $this->map($data, UrlMapperInterface::MODE_PUBLIC_TO_INTERNAL);
        } else {
            return $data;
        }
    }
573743
public function lostPassword($data) {
        $response=CodeBank_ClientAPI::responseBase();
        $response['login']=true;
        
        
		$SQL_email=Convert::raw2sql($data->user);
		$member=Member::get_one('Member', "\"Email\"='{$SQL_email}'");

		// Allow vetoing forgot password requests
		$sng=new MemberLoginForm(Controller::has_curr() ? Controller::curr():singleton('Controller'), 'LoginForm');
		$results=$sng->extend('forgotPassword', $member);
		if($results && is_array($results) && in_array(false, $results, true)) {
		    $response['status']='HELO';
			$response['message']=_t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email'=>$data['Email']));
		}

		if($member) {
			$token=$member->generateAutologinTokenAndStoreHash();

			$e=Member_ForgotPasswordEmail::create();
			$e->populateTemplate($member);
			$e->populateTemplate(array(
				'PasswordResetLink'=>Security::getPasswordResetLink($member, $token)
			));
			$e->setTo($member->Email);
			$e->send();

			$response['status']='HELO';
			$response['message']=_t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email'=>$data->user));
		}else if(!empty($data->user)) {
			$response['status']='HELO';
			$response['message']=_t('CodeBankAPI.PASSWORD_SENT_TEXT', "A reset link has been sent to '{email}', provided an account exists for this email address.", array('email'=>$data->user));
		}else {
			$response['status']='EROR';
			$response['message']=_t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.');
		}
		
		
		return $response;
    }
1041985
protected function getRequestUrl($data)
    {
        $queryParams = $data;

        unset($queryParams['biz_content']);
        ksort($queryParams);

        $url = sprintf('%s?%s', $this->getEndpoint(), http_build_query($queryParams));

        return $url;
    }
278853
public function decrypt(string $data): string
    {
        $this->clearErrors();

        $vector = $this->getIV();
        if (empty($vector) === true) {
            $ivLength = $this->openSslIvLength($this->getMethod());
            $vector   = $this->readIV($data, $ivLength);
            $data     = $this->extractData($data, $ivLength);
        }

        if ($this->isUseAuthentication() === true) {
            $tagLength = $this->getTagLength();
            $tag       = $this->readTag($data, $tagLength);
            $data      = $this->extractData($data, $tagLength);

            $decrypted = $this->openSslDecryptAuthenticated(
                $data,
                $this->getMethod(),
                $this->getPassword(),
                $this->getOptions(),
                $vector,
                $this->getAdditionalAuthenticationData(),
                $tag
            );
        } else {
            $decrypted = $this->openSslDecrypt(
                $data,
                $this->getMethod(),
                $this->getPassword(),
                $this->getOptions(),
                $vector
            );
        }

        return $decrypted;
    }
178697
protected static function validateSortByOrder(string $data): string
    {
        $options = array_keys(Options::getSortByOrders());
        if (!in_array($data, $options)) {
            $data = Options::DEFAULT_SORT_BY_ORDER;
        }

        return $data;
    }
941857
public final function login($data = null) {
        $this->isLogin = $this->doAuth($data);
        if ($this->isLogin) {
            fire('passport\on' . ucfirst($this->type) . 'PassportLogin', $this);
            $this->store();
        }

        return $this->isLogin;
    }
950957
public function write_setting($data) {
        if(!is_array($data)) {
            return ''; // ignore it
        }

        $result = '';
        foreach ($data as $roleid => $data) {
            if (!$this->config_write('contexts_role'.$roleid, trim($data['contexts']))) {
                $return = get_string('errorsetting', 'admin');
            }
            if (!$this->config_write('memberattribute_role'.$roleid, core_text::strtolower(trim($data['memberattribute'])))) {
                $return = get_string('errorsetting', 'admin');
            }
        }
        return $result;
    }
363560
protected function _write($data) {
		if (!$this->connected && !$this->connect()) {
			return false;
		}

		$data .= "\r\n";
		return fwrite($this->_connection, $data, strlen($data));
	}
1066279
public function redirect(array $data = []): ?array
    {
        if (! isset($data['billplz']) || ! \is_array($data['billplz'])) {
            throw new InvalidArgumentException('Expected $billplz to be an array!');
        }

        $bill = [
            'billplzid' => $data['billplz']['id'],
            'billplzpaid' => $data['billplz']['paid'],
            'billplzpaid_at' => $data['billplz']['paid_at'],
            'x_signature' => $data['billplz']['x_signature'] ?? null,
        ];

        $validated = $this->validateAgainstSignature($bill, $this->client->getSignatureKey(), [
            'billplzid', 'billplzpaid_at', 'billplzpaid',
        ]);

        if ((bool) $validated) {
            return $this->filterResponse($data['billplz']);
        }

        return null;
    }
4047
public function escape($data) {

		if(null === $data) {
			return $data;
		}

		if(false === is_string($data) && false === is_numeric($data)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, float or int, "%s" given', __METHOD__, gettype($data)), E_USER_ERROR);
		}

		if(null === $this -> connection) {
			$this -> connect();
		}

		return $this -> connection -> real_escape_string($data);
	}
584300
public static function decode($data)
    {
        if (!is_string($data)) {
            throw new InvalidArgumentException('data must be string');
        }

        // undo the URL safe replacement
        $convertedData = strtr($data, '-_', '+/');

        // restore the padding
        switch (strlen($convertedData) % 4) {
            case 0:
                break;
            case 2:
                $convertedData .= '==';
                break;
            case 3:
                $convertedData .= '=';
                break;
            default:
                throw new InvalidArgumentException('invalid base64url string length');
        }

        return parent::decode($convertedData);
    }
186632
function write_setting($data) {
        $previous = $this->get_setting();

        if ($previous === null) {
            if ($data) {
                $this->regrade_all();
            }
        } else {
            if ($data != $previous) {
                $this->regrade_all();
            }
        }
        return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
    }