public static function setPost($strKey, $varValue) { $strKey = static::cleanKey($strKey); unset(static::$arrCache['postEncoded'][$strKey]); unset(static::$arrCache['postDecoded'][$strKey]); unset(static::$arrCache['postHtmlEncoded'][$strKey]); unset(static::$arrCache['postHtmlDecoded'][$strKey]); unset(static::$arrCache['postRaw'][$strKey]); unset(static::$arrCache['postUnsafeRaw'][$strKey]); if ($varValue === null) { unset($_POST[$strKey]); } else { $_POST[$strKey] = $varValue; } }
/** * Contao ImportUser Hook Implementation * * Imports a user from phpbb if login credentials match * * @param $username * @param $password * @param $scope * @return bool */ public function onImportUser($username, $password, $scope) { if ($scope == 'tl_member') { // Before we try to import a user, we must check is username is maybe = username_clean // We already now that the user could not be found by username column if (($real_username = $this->findByCleanUsername($username)) != '') { // So we found the user by it's clean username, then we overwrite the POST Value // because contao will recheck it. Input::setPost('username', $real_username); return true; } $loginResult = System::getContainer()->get('phpbb_bridge.connector')->validateLogin($username, $password); // Only import user if login to forum succeeded if ($loginResult === true) { System::log("Trying to import User: " . $username, __METHOD__, TL_ACCESS); // Try to import the user to contao (tl_member / frontend) $importResult = System::getContainer()->get('phpbb_bridge.connector')->importUser($username, $password); return $importResult; // Should usually be true } } return false; }